Solved

DateTime regardless of time zone in SQL Server 2005

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

760 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

18 Experts available now in Live!

Get 1:1 Help Now