Skip to content

Time Util API

It’s important to remember that regardless of time zone used to display the value in the client, the server side will be storing it in UTC.

To convert the date values related to time zones, a set of methods have been introduced in the TimeUtil utility package. (Time_Util_API). This package is in FNDBAS component.

Please note that Timezone identifiers can be specified using the following formats

  • ISO standard (E.g. Asia/Colombo) – Recommended

  • Offset (+5:30)

  • UTC/GMT

The following methods are included.

  • Convert_Timezone :

Converts a Date value in a given time zone (from_timezone_) to a different time zone (to_timezone).

  • Convert_Utc_To_Timezone :

Converts a date value in UTC time zone to a different Timezone (to_timezone_).

  • Convert_Timezone_To_Utc :

Converts a date in a given time zone (from_timezone_) to UTC.

  • Convert_To_System_Timezone :

Converts a date in a given time zone (from_timezone_) to the time zone the database is running (NOTE: This is the time zone of the Database Server and not the DBTIMEZONE value).

  • Get_Sysdate_In_Utc :

Get the current time in UTC.

  • Get_Current_Time_In_Timezone :

Get’s the current time in a given time zone.

  • Get_Current_Time_Difference :

Get the time difference between two time zones, if first_timezone is a head of second Timezone the value will be a positive number, otherwise it will be a negative number. This can be directly added/subtracted from date fields to do calculations.

  • Get_Cur_Server_Time_Difference :

Get the time difference between the server time and a given time zone, if the server is a head of the given time zone the value will be a positive number, otherwise it will be a negative number. This can be directly added/subtracted from date fields to do calculations.