12/26/2023 0 Comments Sql convert string to date yyyymmddSelect replace(convert(varchar, getdate(),101),'/','') + replace(convert(varchar, You can also format the date or time without dividing characters, as well asĬoncatenate the date and time string: Sample statement The date usedįor all of these examples is " 00:38:54.840". Check out the chart to get a list of all format optionsīelow is a list of SQL date formats and an example of the output.To get MM/DD/YY use this T-SQL syntax SELECT CONVERT(varchar, getdate(), 1).To get YYYY-MM-DD use this T-SQL syntax SELECT CONVERT(varchar, getdate(), 23).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |