sql - Cast Datetime offset to Date -
i have date column in datetimeoffset format.
2016-01-09 05:49:06.3744350 +00:00
i want convert date format, e.g. 2016-01-09
. able convert datetimeoffset datetime2 query.
convert(datetime2, sampledate, 1) date
would obliged if know how convert desired format in ms sql.
simply:
select convert(date, convert(datetimeoffset, '2016-01-09 05:49:06.3744350 +00:00'))
returns:
2016-01-09
Comments
Post a Comment