Click or drag to resize
ZenophSMSgetTimeZones Method
Gets the time zones in the form of regions and cities. These are the values that are actually returned by PHP.

Namespace: Zenoph.SMSLib
Assembly: Zenoph.SMSLib (in Zenoph.SMSLib.dll) Version: 2015.9.30.0 (2015.09.30.0)
public static Dictionary<string, List<string[]>> getTimeZones()

Return Value

Type: DictionaryString, ListString
Returns the time zone regions and cities as returned by PHP with underscores replaced by white spaces.
ExceptionThrown when user authentication has not been performed.

The time zones are returned in a System.Collections.Generic.Dictionary<TKey, TValue> object. The regions such as Africa, Europe, Asia, America, etc., are contained in the keys while the cities for each region are contained in a List<string[]> object. Each item in the List is an array of System.String with the first index (0) being the city and the second index (1) being the time zone offset from GMT.

The key and value pairs can be used, particularly in GUI forms, in the selection of a region and city in order to determine the time zone offset from GMT.

The following is a complete example code that demonstrates the use of the time zones from this method call. It prints out the region and city combinations with their respective time zone offset from GMT.
// Initialise SMS object and perform authentication.
ZenophSMS sms = new ZenophSMS();

// get the time zones
Dictionary<string, List<string[]>> timezones = ZenophSMS.getTimeZones();

// Each string array in the list contains two elements. The first indiex is the city
// while the second index is the time zone offset from GMT.
List<string[]> region = timezones["Europe"];

// print first item in the list on screen
string[] city = region[0];
Console.WriteLine(string.Format("City: {0},  GMT Offset: {1}", city[0], city[1]));
See Also