Solved

DateTime regardless of time zone in SQL Server 2005

Posted on 2007-03-28
3
2,323 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now