Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Determine UTC from specific local datetime
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

1 Posts

Posted - 03/21/2013 :  13:52:40  Show Profile  Reply with Quote
Let me start by listing the constraints I'm working under:

- I have read-only access to the database
- I am working in Crystal Reports, using the custom SQL command functionality
- SQL server 2008
- Crystal v11 / 2005

I have the need to determine a UTC datetime given a specific local datetime.

For instance:

- Given 2/28/13 1:00 AM local (-5 offset) the UTC would be 2/28/13 6:00 AM.

My problem is I do not know the offset and cannot figure a way out to calculate it for a specific datetime.

The current offset is easy...a datediff from a getdate and getUTCdate, but that gives you the wrong offset depending on the datetime.

For instance right now for New York the offset is -4 because we're in daylight saving time, so if I use the getdate/getUTCdate difference I'll get 4, but if I apply that to say...2/28, I'll get the wrong UTC date because on 2/28 the offset was -5 (not daylight saving).

I cannot do this at the app (crystal) level due to the dataset I require, so I'm stuck with a SQL query, and I cannot write a store procedure or function because I have read-only access.

Anyone have any idea how I can accomplish this?
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000