Question: I'm storing the user's timezone as a decimal in the session. For instance, if the user is in the EST timezone, I'd have 

```
UserTimeZone = -5.00;

```

The data in the database is stored in UTC, so I want to calculate the beginning and the end of the day for that user so that when the user wants his data for a specific day, the records are timezone adjusted.

This is what I'm doing:

```
DateTime StartDate =  DateTime.Now.ToUniversalTime();

StartDate = StartDate.AddHours((double)UserTimeZone);
StartDate = StartDate.Date;
StartDate = StartDate.AddHours((double)UserTimeZone);

DateTime EndDate = StartDate.AddHours(24);

```

The problem I'm having is that this doesn't account for daylight saving time so even thought EST time is 5 hours behind UTC, for the moment it's actually 4 hours behind UTC because of the daylight saving shift.

What are some of your suggestions? Thanks.

Answer: 
The correct answer is what everyone has told you to do - use the TimeZone APIs in the framework. But prior to .NET 3.5 the TimeZoneInfo APIs didnt exist. If you really don't want to use the APIS, or you are using something prior to .NET 3.5, you can find all the timezone info in the registry at 

`HKLM/Software/Microsoft/Windows NT/CurrentVersion/Timezones`

There are a set of classes available at <http://www.michaelbrumm.com/simpletimezone.html> that read the registry data directly and do all the timezone calculations required - with adjustments for DST. It's good code (we've used it reliably for years) with source, so you can see what they are actually doing.
You shouldn't be doing any of this. You should just use the TimeZoneInfo built into .net.

For example:

```
TimeZoneInfo.ConvertTimeToUtc();
TimeZoneInfo.ConvertTimeFromUtc();

```

Since you don't seem able to lookup API Parameters, here you go:

<http://msdn.microsoft.com/en-us/library/system.timezoneinfo.converttimefromutc.aspx>

<http://msdn.microsoft.com/en-us/library/bb381744.aspx>