Converting time according to a time zone

  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 to get the current time according to a user's time zone settings:

 

[C#]

 

using CMS.SiteProvider;

 

...

 

        // Get user

        UserInfo ui = UserInfoProvider.GetFullUserInfo("administrator");

 

        // If user exist

        if (ui != null)

        {

            // Get converted time

            System.DateTime convertedTime = TimeZoneHelper.ConvertUserDateTime(System.DateTime.Now, ui);

        }

 

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