DateTime Control in ASP.NET EST vs PST ???
Posted on 2007-03-28
I have a datetime control that I am using and am having some issues with the hour portion. Depending on format the user wants the control will display a drop down with portions of the date and time. Here is the code that generates the hour dropdown:
hourPart = new DateDropDownList(DateTimePart.Hour);
int HrWork = 0;
HrWork = i;
if (i > 12)
HrWork = i - 12;
hourPart.Items.Add( new ListItem(HrWork.ToString("d2"), HrWork.ToString()) );
Since this user only is available from 9 to 6 the dropdown only displays those hours. The issue is at the other end. When they pick an hour from the dropdown, for example, 10 the control is returning 1. It's as though it is assuming PST for the control and EST when I retreive the data. Here is the code that retrieves the data:
StartHourEmail = StartHour.SelectedDateTime.Hour.ToString("00");
There is probably an easy answer for you experts. This is kind of urgent.
Does anyone have any ideas why this is happening??