Using SQL Server 2019, I have a simple query that returns dates from a table as shown below.
The query used to get this data is:
select
convert(datetime2(0), SBTRM_BEGIN_DTE, 126) at time zone 'Eastern Standard Time' as 'start_date' --IS0 8601
, SBTRM_BEGIN_DTE
, convert(datetime2(0), SBTRM_END_DTE, 126) at time zone 'Eastern Standard Time' at time zone 'Eastern Standard Time' as 'end_date' --IS0 8601
, SBTRM_END_DTE
Why is the end_dte for any date in December showing at UTC-5:00 instead of UTC-4:00 (Eastern Standard Time)?
Ultimately I'd like dates formatted as 'YYYY-MM-DDTHH:MM:SSZ' to utilize in a data upload. I've tried solutions using format() but this is the closest to what I'm trying to output.
1条答案
按热度按时间cygmwpex1#
As others have already written, the Daylight Saving Time (DST) is included in the 'TIME ZONE'.
I've always used 'UTC' during my active time.
Here's an example:
In this system table you will find the installed TIME ZONES:
Example