Getting time zone data

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  

The following sample code shows how you can get a time zone as a TimeZoneInfo object:

 

[C#]

 

using CMS.SiteProvider;

 

...

     

        // Get time zone object by time zone code name

        TimeZoneInfo tzi = TimeZoneInfoProvider.GetTimeZoneInfo("Hawaii");

 

        // Get time zone object by ID

        TimeZoneInfo tzi2 = TimeZoneInfoProvider.GetTimeZoneInfo(1);

 

The following sample code shows how you can get a DataSet containing time zones from the system:

 

[C#]

 

using System.Data;

using CMS.SiteProvider;

 

...

 

        string where = "TimeZoneID > 10";

        string orderBy = "TimeZoneDisplayName";

        int topN = 10;

        string columns = "TimeZoneID, TimeZoneDisplayName, TimeZoneGMT";

 

        // Get dataset of time zones according to the given parameters

        DataSet ds = TimeZoneInfoProvider.GetTimeZones();

 

        DataSet ds2 = TimeZoneInfoProvider.GetTimeZones(where, orderBy);

 

        DataSet ds3 = TimeZoneInfoProvider.GetTimeZones(where, orderBy, topN, columns);

 

Page url: http://devnet.kentico.com/docs/5_5r2/devguide/index.html?api_getting_time_zone_data.htm