I have a web app hosted with GoDaddy (so the web server is in Arizona - Mountain Time). My users are mostly in Central Time Zone, but I could have some from other time zones.
I have a web page with a databound dropDownList using TimeZoneInfo, and I want to set the selected value of this dropDownList to whatever timeZone the user is in. Here's my code currently:
protected void Page_Load(object sender, EventArgs e)
{
DropDownListTimeZone.DataSource = TimeZoneInfo.GetSystemTimeZones();
DropDownListTimeZone.DataBind();
TimeZoneInfo cst = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");
DropDownListTimeZone.SelectedValue = cst.DisplayName;
}
It's ok, but I want it to be smarter for those users who aren't in CST. I was hoping there is some way to grab the user's TimeZoneInfo from something like Page.Request.?? but I can't figure it out.
Is there an easy solution to this?