SQL Apprentice Question
In my Database, all date and time are stored in GMT, however, when it
is displayed, I need them in EST. How can this be done with Daylight
saving time taken into account as well?
>> In my Database, all date and time are stored in GMT, .. <<
Interesting. GMT has not existed for a VERY LONG TIME! Google iot, so
you will not look so far behind. Did you mean UTC and just do not
bother to learn this decade's technology?
>> How can this be done with Daylight Saving Time taken into account as well? <<
This is called "local lawful time" and it varies quite a bit. Set up
a copy of the Standard SQL temporal information tables that MS has not
bothered with yet. Then set up VIEWs and use them. These auxiliary
tables will have (start_time, end_time, displacement off of UTC)
columns for the DST.