Calculating daylight saving time automatically

M

maflatoun

Hi guys,

I have to make a event signup page for our company that would display
the event time/date in 3 different time zones (Eastern - New York,
Central - Chicago, and Pacific - San Francisco). To do this. I convert
the inputed date from local time zone and convert it into UTC and store
it in the database (correct me if I'm wrong please). Next to display it
I would add the correct time zone difference value (-5 for Eastern).
How to do I handle the daylight saving time though? For example the -5
Eastern time is right now -4. Is there a way to do this automatically?
Any samples would be greatly appreciated.


Thanks
M.
 
M

Michael A. Covington

I believe Windows does keep track of whether daylight saving time is in
effect in its location.
 
C

Chris Dunaway

Hi guys,

I have to make a event signup page for our company that would display
the event time/date in 3 different time zones (Eastern - New York,
Central - Chicago, and Pacific - San Francisco). To do this. I convert
the inputed date from local time zone and convert it into UTC and store
it in the database (correct me if I'm wrong please). Next to display it
I would add the correct time zone difference value (-5 for Eastern).
How to do I handle the daylight saving time though? For example the -5
Eastern time is right now -4. Is there a way to do this automatically?
Any samples would be greatly appreciated.

You shouldn't have to do any calculations at all. If you use
DateTime.ToUniversalTime and DateTime.ToLocalTime, it should take
Daylight Savings into account automatically and return the correct
values.
 

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