Click here to Skip to main content
15,888,527 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

How to display Timezone List in DropDownList.I want List in Below format:

(GMT-07:00) Mountain Time (US and Canada)

Also i want save "-07:00" only.In sql server which datatype will support this value.


Thanks in advance,

Ruchi
Posted
Comments
Richard C Bishop 19-Apr-13 11:35am    
Just add that data as a list item, what is the problem? If you only want to save a certain part, use the substring() method.
Member 9555053 19-Apr-13 11:43am    
I am not getting it in GMT format. Its displaying as UTC format.
Currently using Below function:

public Collection<mystruct> GetTimeZones()
{
var myClass = new Collection<mystruct>();
foreach (var timeZoneInfo in TimeZoneInfo.GetSystemTimeZones())
{
myClass.Add(new MyStruct { Name = timeZoneInfo.DisplayName, ID = timeZoneInfo.Id });


}
return myClass;
}
public struct MyStruct
{
public string Name { get; set; }
public string ID { get; set; }
}
José Amílcar Casimiro 19-Apr-13 11:59am    
Please, improve your question instead of dump code into comments. Thanks.
ZurdoDev 19-Apr-13 12:15pm    
Drop downs have both a text and value so this should be easy. What's the issue?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900