Solved

DateTime regardless of time zone in SQL Server 2005

Posted on 2007-03-28
3
2,326 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 Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Not selecting duplicate data 6 60
SQL 2005 - Memory Table Column Names 11 76
ms sql + top 1 for each customer 3 57
Anyway to make these 2 SQL statements into one? 13 42
This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

860 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