How do you convert Eastern Time zone to GMT datetime

G

GG

I have some datetime values in SQL server stored in Eastern time zone.
I need to convert them to GMT.
The pc that I will be running the app has local time zone set to eastern
time.

Is this code enough for the translation to GMT?
DateTime easternDateEime = value from the db;
easternDateEime.ToUniversalTime();

Do I need to worry about daylight savings?
If yes how do we do that?


Thanks
 
N

Nicholas Paldino [.NET/C# MVP]

GG,

If you are sure that the app that is running the code is set to the same
time zone as what is stored in the SQL server table, then the code that you
posted will give you the time you want (although one would argue that you
should store the value in the db in universal time and convert on your way
out).

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top