DateTime Time Zone Adjustments

How to handle time zone adjustments in a customization

The PlanetTogether scheduler performs all of its operations using the UTC  time. To easily convert from UTC to Local time or vice versa, we can use some functions located in PT.Common.TimeZoneAdjuster.

This small example illustrates how to convert between local and UTC DateTime objects:

private DateTime ConvertToUTC(DateTime a_dateTime)
{
//Perform conversion
DateTime utcDate = PT.Common.TimeZoneAdjuster.ConvertToServerTime(a_dateTime);
return utcDate;
}

private DateTime ConvertToLocal(DateTime a_dateTime)
{
//Perform conversion
DateTime localDate = PT.Common.TimeZoneAdjuster.GetDisplayTime(a_dateTime);
return localDate;
}

 

Next Steps
Explore the following articles to learn all there is to know about customization projects in PlanetTogether:

Getting started with customizations

Advanced topics