I have a table with users, UTC time offset, and if they observe daylight saving time. Is there a built in way to get the correct user time?
相关问题
- SQL join to get the cartesian product of 2 columns
- sql execution latency when assign to a variable
- Difference between Types.INTEGER and Types.NULL in
- php PDO::FETCH_ASSOC doesnt detect select after ba
- Bulk update SQL Server C#
Right now I'm doing this:
It works but if the server get's moved to another timezone or doesn't fallow daylight saving time I'm hosed.
Different time zones around the world observe DST in different ways. They start and stop at different times of the day. Simply having an offset and DST flag is not enough to reliably convert.
Instead, you need a time zone identifier, such as
America/Los_Angeles
, or one of the others listed here. Once you have that, you can use my SQL Server Time Zone Support project to do the conversions.