How to Get TimeZoneInfo list in C#
using System.Collections.ObjectModel;
using System.Web;
ReadOnlyCollection<TimeZoneInfo> timeZones = TimeZoneInfo.GetSystemTimeZones();
List<UTCList> lstUTCList = new List<UTCList>();
foreach (TimeZoneInfo timeZone in timeZones)
{
lstUTCList.Add(new UTCList() { Name = timeZone.DisplayName, ID = timeZone.Id });
}
SelectList objSelectList = new SelectList(lstUTCList, "ID", "Name", "India Standard Time");
Session["List of Data"] = objSelectList;
{
public string Name { get; set; }
public string ID { get; set; }
}
Comments
Post a Comment