convertTimezone

The convertTimezone task converts a timestamp by offsetting the input value in whole hour increments. This task does not take true UTC time into account — the input time is always treated as the 0:00 marker (no offset), and the output is the chosen offset applied to the input value. The output format matches the format specified in the input time.

Potential use case

Use this task when your workflow imports a timestamp from a device in a different time zone and you need to offset it to blend chronologically with log file history from devices in your time zone.

Properties

IncomingTypeDescription
inputTimeObjectRequired. The date/timestamp to convert.
NewTimezoneEnumRequired. An hour offset applied to the inputTime value to produce the new time zone.
OutgoingTypeDescription
convertedTimeObjectThe inputTime converted to the NewTimezone value.

Example 1

In this example:

  • The inputTime comes from the getTime reference task. The reference variable is time.
  • The NewTimezone is set to +01:00 (a one-hour increment).
  • If the inputTime was 03:00, the convertedTime would be 04:00.
convertTimezone task with inputTime from getTime and NewTimezone set to +01:00

Example 2

In this example:

  • The inputTime comes from the getTime reference task. The reference variable is time.
  • The NewTimezone is set to -02:00 (a two-hour difference).
  • If the inputTime was 03:00, the convertedTime would be 01:00.
convertTimezone task with inputTime from getTime and NewTimezone set to -02:00

Example 3

In this example:

  • The inputTime comes from the getTime reference task. The reference variable is time.
  • The NewTimezone is set to +00:00 (no offset).
  • If the inputTime was 03:00, the convertedTime would remain 03:00.
convertTimezone task with inputTime from getTime and NewTimezone set to +00:00

Manual reference variable entry

To enter the inputTime object manually, use the Year-Month-Date-Time format (yyyy-MM-dd 'T' HH:mm:ss.SSSZ):

1{"time": "2021-02-26T15:00:00.000Z"}

This displays as:

2021-02-25 03:00.00