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: 
As BrokenGlass mentioned, a simple offset is not enough information to determine the handling of daylight hours, since different countries in each zone might handle daylight savings differently. The C# `TimeZone` class is more specific, and has support for daylight savings (check details on [MSDN](http://msdn.microsoft.com/en-us/library/system.timezone.aspx)). Unfortunately there is no easy way to get the relevant timezone from the browser, but there are several suggestions on [this post](https://stackoverflow.com/questions/832986/how-to-work-with-timezone-in-asp-net) regarding how you can allow the user to pick their timezone.

If you want to try and work out the timezone without the user's assistance, there are a few ways to do that (typically revolving around getting the browser's preferred language, and then mapping that to a country...), some examples are [here](http://forums.asp.net/p/1091541/1637555.aspx) and [here](http://social.msdn.microsoft.com/forums/en-US/netfxbcl/thread/772971a4-9f1b-4004-a873-c1e0e2098852/).
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>