New Upload weather data from web services into TM1/Planning Analytics — Read the post →

Dealing with daylight saving time and time zones in TM1

Dealing with daylight saving time and time zones can be challenging, but luckily, IBM Planning Analytics powered by TM1 has many features to help you overcome this situation.

In this article, you will learn how TM1 can help you with getting dates in different languages, calculating the time difference between two time zones, and rescheduling your chores by one hour.

Hello World TM1 Process

The examples can be run in your environment by downloading the HelloWorldTM1Date TurboIntegrator process. Let's first get familiar with three important TI functions: FormatDate, ParseDate and NewDateFormatter.

How to use FormatDate

The FormatDate function formats a date value according to a formatter. If no formatter is defined, the function returns the default format according to your location:

The second argument specifies a format:

How to use ParseDate

ParseDate parses a date string and returns a date value:

How to use NewDateFormatter

NewDateFormatter defines a date formatter used by FormatDate. The first argument is the Locale setting:

To get a time, specify datetime as the 5th argument:

The second argument is the timezone (from the Wikipedia list of time zones). The third argument specifies milliseconds since epoch (unix) or TM1 serial format (serial). The fourth specifies format style (short, medium, long, full).

Get the date in different languages

Use the Locale argument to get dates in different languages:

Other examples: en-gb → Wednesday, 1 April 2020, de-DE → Mittwoch, 1. April 2020, no-no → onsdag 1. april 2020, nl-nl → woensdag 1 april 2020.

Calculating time difference between two time zones

In this example we calculate the time difference between Sydney and London in three steps:

Step 1 — Convert the date to Sydney time:

Step 2 — Get London time from Sydney date value:

Step 3 — Calculate the difference:

Reschedule all chores by one hour

Rescheduling all chores by one hour can be achieved easily with TM1py:

This script can be executed from a TM1 process using ExecuteCommand:

IBM Planning Analytics (TM1 v11) introduced the option to set a chore in local time, which should remove the need to reschedule all your chores twice per year when going on and off daylight savings.