1

My SQL Server is located in US Mountain Standard Time where the Daylight Savings is not observed. My office is in US Central time zone. All schedules are kept in Central time by business.

I am trying to figure out how to allow business to enter job schedules in a table in Central time and convert those to Mountain, taking Daylight Savings into account.

TIA!

9
  • So all data is stored as central time (with DST already taken into account) and you just want mountain time users to see / search based on their time zone? What version of SQL Server are you using? Can you show some sample data? Personally I'm a fan of storing UTC (since it's far easier to convert from UTC to any time zone with or without DST than it is to convert from one time zone to another, especially when one has DST and the other doesn't). Jon Skeet has a different opinion: codeblog.jonskeet.uk/2019/03/27/… Commented Oct 9, 2020 at 13:51
  • 1
    The version of SQL Server is important. AT TIME ZONE may suit your needs, see this and this. Commented Oct 9, 2020 at 14:27
  • 1
    The server may know the offset right now (depending on the server's own timezone settings), but it won't magically apply the offset for a date in the past or the future. AT TIME ZONE just requires the name of the time zone, here is a better example: dbfiddle.uk/… Commented Oct 9, 2020 at 14:38
  • 1
    @David the fiddle didn't store any data, it was just demonstrating that you can take a date/time from any time zone (I chose UTC) and translate it to another time zone (I demonstrated both) without having to specify an offset (I was just addressing the OP's comment: AT TIME ZONE ... require the offset hours parameter). Commented Oct 9, 2020 at 20:09
  • 1
    It sure does make it easier if you store all dates in UTC though.
    – Hannah Vernon
    Commented Oct 9, 2020 at 20:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.