将日期时间偏移量转换为日期

Nir*_*han 1 sql sql-server

I have the date column in datetimeoffset format.

2016-01-09 05:49:06.3744350 +00:00
Run Code Online (Sandbox Code Playgroud)

I want to convert it to only date format, e.g. 2016-01-09. I was able to convert datetimeoffset to datetime2 with this query.

convert(datetime2, sampleDate, 1)  as date
Run Code Online (Sandbox Code Playgroud)

Would be much obliged if I could know how to convert this to the desired format in MS SQL.

Hon*_*ger 6

Simply:

SELECT CONVERT(DATE, CONVERT(DATETIMEOFFSET, '2016-01-09 05:49:06.3744350 +00:00'))
Run Code Online (Sandbox Code Playgroud)

Returns:

2016-01-09
Run Code Online (Sandbox Code Playgroud)