🇺🇸 Pacific Time (US) PDT UTC-7 5:00 am May 2 May 3 May 4 May 5 May 6 May 7 🇺🇸 Mountain Time (US) MDT UTC-6 6:00 am May 2 May 3 May 4 May 5 May 6 May 7 🇺🇸 Central Time (US) CDT UTC. UTC -7 Pacific Daylight Time is currently observed. Pacific Daylight Time (PDT) is observed in the Pacific Coast of United States and Canada, and Baja California Norte of Mexico in summer.
Translate Pdt To Utc
Recently we needed to convert all dates in our database to UTC format. We've made a mistake not storing them in UTC from the beginning and it led to complicated issues. When you have to support various time zones, there is no other way but to store you dates in UTC.
Luckily enough SQL Server comes with a handy GETUTCDATE() function, which, as you all have guessed, returns the current UTC date. The only thing you need to know to convert your dates to UTC is the offset between your server's time and UTC. You can do it like this:
For Eastern Standard Time that will be -5. So to convert your dates to UTC you need to do this:
Utc (zulu) pst/ aldt pdt/ mst mdt/ cst cdt/ est edt/ ast alst hst: 1300: 0500: 0600: 0700: 0800: 0900: 0400: 0300: 1400: 0600: 0700: 0800: 0900: 1000: 0500: 0400. GMT ( UTC ): » Universal Time to Local Time Main Conversion Page. Scale:. Is local time not Right? Input the time zone below to convert: » UTC to Worldwide Timezone Converters. Universal Time Offset: UTC +0. 6:00 AM Universal Time conversion to worldwide times: Adelaide. Athens. 9:00 AM.
But there is one problem.
Utc To Mountain Daylight Time
Currently the offset between UTC and EST is actually -4, since it's summer and we are now in daylight savings time (EDT). So the above code will substract 4 hours from every date we have. But obviously lots of those past dates are not during daylight savings and you need to substract full five hours from them. Turns out there is really no way around that in SQL Server.
But you can perform the converion outside of SQL. .NET has great built in tools to convert between time zones with daylight savings support. It is really easy to do the conversion in C#:
Then you just need to store it in the database and you are all set. You can even create a CLR stored procedure out of that method. Hopefully all of the above will save you some time.
Max Al Farakh
Max is a co-founder/CTO of Jitbit with tons of experience in customer service.