How to Get TimeZoneInfo list in C#


using System.Web.Security;
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 class UTCList
        {
            public string Name { get; set; }
            public string ID { get; set; }
        }

Comments

Popular posts from this blog

How to create RSS Feed in Asp.Net

Auto generate change scripts in SQL Server Management Studio SSMS for tables

HOW TO Use the NumericUpDown Control