Date converter and formatter

Availability table

Controller availability

Module

Available

module.scripts

Supported feature

module.keycloak

Supported feature

timestamp controller

Allow script to reformat and edit timezone of timestamps.

timestamp.format(format: string, epochMilli: number)

Convert a date passed as milliseconds into a string representation using a given format in UTC timezone.

Arguments:
  • format – Destination format of the date. (default:dd/MM/yyyy HH:mm)

  • epochMilli – Time in [ms] sinch epoch.

Returns:

Return a string that represent a date human readable formated.

timestamp.format(format: string, epochMilli: number, timeZone: string)

Convert a date passed as milliseconds into a string representation using a given format and a given timezone.

Arguments:
  • format – Destination format of the date. (default:dd/MM/yyyy HH:mm)

  • epochMilli – Time in [ms] sinch epoch.

  • timeZone – Timezone of the destination date (default UTC)

Returns:

Return a string that represent a date human readable formated.

timestamp.format(epochMilli: number)

Convert a date passed as milliseconds into human readable string using default format and UTC timezone. (dd/MM/yyyy HH:mm)

Arguments:
  • epochMilli – Time in [ms] sinch epoch.

Returns:

Return a string that represent a date human readable formated.

Timestamp

class timestamp.Timestamp()

An unmodifiable timestamp

Timestamp.epochMillis

The timestamp value in milliseconds.

The type of the field is number.

Timestamp.compareTo(epochMillis: number)
Arguments:
  • epochMillis – A epoch timestamp in millisecond

Returns:

Return

  • 0: if the timestamps are equals.

  • -1: if the timestamp is before other.

  • 1: if the timestamp is after other.

Timestamp.compareTo(other: Timestamp)
Arguments:
  • other – Another timestamp

Returns:

Return

  • 0: if the timestamps are equals.

  • -1: if the timestamp is before other.

  • 1: if the timestamp is after other.