Solved

DateTime regardless of time zone in SQL Server 2005

Posted on 2007-03-28
3
2,327 Views
Last Modified: 2008-01-09
Say I was born on June 1st, 2000. If anybody asked me, in any part of the world, when I was born I would say June 1st, 2000. I wouldn't say something like "Well, Im in Fiji now and I was born in Canada, so adjusted for time zone differecne I was born on June 2, 2000" or something like that.

Is there any way in SQL Sever 2005 to specify DateTime that is the same for all time zones? If not, in C#, is there any easy way to play around with DateTime object to achieve the functionality?

Thanks!
0
Comment
Question by:krupini
  • 2
3 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 18811465
you will get the GMT time using  GetUTCDate()
0
 

Author Comment

by:krupini
ID: 18811669
Say I have a SimpleTable:

Name      BirthDate
Alex        2000-01-01
Tom        2000-01-02

In my C# code, when I call "SELECT * FROM SimpleTable" and populate the dataset, and then access the dates, the dates will be adjusted for time zone. So where exactly should I call GetUTCDate() ?
0
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 500 total points
ID: 18811850
when u store the Birthday, store the GMT Datetime in the filed. and while retriving, you can compare the value with GetUTCDate() to give you the exact difference
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question