Try OpenEdge Now
skip to main content
ABL Data Types Addenda
DATETIME and DATETIME-TZ data types : Related ABL functions
 

Related ABL functions

You can use the DATETIME and DATETIME-TZ functions to create DATETIME and DATETIME-TZ variables and fields:
*DATETIME — Creates a DATETIME from date and time values or from a character string. The following example uses the DATETIME function:
DEF VAR my-datetime as DATETIME.

my-datetime = DATETIME(TODAY, MTIME).

/* The statement above is equivalent to "my-datetime = NOW". */
*DATETIME-TZ — Creates a DATETIME-TZ from date, time, and time zone values or from a character string. The following example uses the DATETIME-TZ function:
DEF VAR my-datetime-tz as DATETIME-TZ.

my-datetime-tz = DATETIME-TZ(TODAY, MTIME, TIMEZONE).

/* The statement above is equivalent to "my-datetime-tz = NOW". */
The ABL functions summarized in the following table support the DATETIME and DATETIME-TZ data types. For details on each of these functions, see OpenEdge Development: ABL Reference.
Table 6. ABL functions related to DATETIME and DATETIME-TZ
Function
Description
ADD-INTERVAL
Adds or subtracts a specified unit of time (days, months, seconds, etc.) to/from a DATETIME or DATETIME-TZ value. This function takes the date, time, and time zone information into account. You can also use this function with a DATE.
DATE
Returns the date part of DATETIME or DATETIME-TZ.
DAY
Returns the day of the month of the date part of the DATETIME or DATETIME-TZ value.
INTERVAL1
Returns an integer that represents an interval between two date/times, expressed in interval-units (days, months, seconds, etc.). This function takes the date, time, and time zone information into account. You can also use this function with a DATE.
ISO-DATE2
Returns the character representation of a DATE, DATETIME or DATETIME-TZ that conforms to the ISO 8601 standard for date/time representations - formats are equivalent to the XML Schema date and dateTime formats.
MONTH
Returns an integer value representing the month of the date part of the DATE, DATETIME, or DATETIME-TZ value.
MTIME3
Returns an integer representing the time part of a DATETIME or DATETIME-TZ in milliseconds. With no arguments, MTIME returns the number of milliseconds since midnight.
NOW4
Returns the current system date, time, and time zone as a DATETIME-TZ. If assigned to a DATETIME, NOW does not include the time zone.
STRING
Converts a value of any data type into a character value.
TIMEZONE5
Returns an integer representing the time zone of a DATETIME-TZ in minutes. With no arguments, TIMEZONE returns the current time zone of the session.
WEEKDAY
Returns the weekday of the date part of the DATETIME or DATETIME-TZ value.
YEAR
Returns the year of the date part of the DATETIME or DATETIME-TZ value.

1 This ABL function is new to OpenEdge Release 10.

2 This ABL function is new to OpenEdge Release 10.

3 This ABL function is new to OpenEdge Release 10.

4 This ABL function is new to OpenEdge Release 10.

5 This ABL function is new to OpenEdge Release 10.