FormatDateTime function
Syntax
FormatDateTime(datetime, {timezone | "Local" | "Base"}, displayTZ)
Description
Use the FormatDateTime function to take a datetime value and convert it to text. If a specific time zone abbreviation, or a field reference, is passed in timezone, FormatDateTime adjusts the DateTime to the user’s local time zone instead of the specified time zone. The system’s base time zone is specified on the PSOPTIONS table. The value datetime is assumed to be in base time.
See System and Server Administration: PeopleTools Options.
If Local is specified for time zone, FormatDateTime adjusts the DateTime to the user’s local time zone instead of a specific time zone.
If True is specified for displayTZ, FormatDateTime appends the time zone abbreviation to the returned string.
Parameters
| Parameter | Description |
|---|---|
|
datetime |
Specify the DateTime value to be formatted. |
|
timezone | Local | Base |
Specify a value for converting datetime. The values are:
|
|
displayTZ |
Specify whether the time zone abbreviation should be appended to the returned string. This parameter takes a Boolean: True if the abbreviation should be appended, False, otherwise. |
Returns
A formatted string value.
Example
The following example populates the &DISPDATE variable with a string containing the DateTime value in the ORDER_DATE field adjusted to the user’s local time zone, and with the time zone abbreviation.
&DISPDATE=FormatDateTime(ORDER_DATE, "Local", True);
The following example populates the &DISPDATE variable with a string containing the DateTime value in the SHIP_DATE field adjusted to the time zone stored in the SHIP_TZ field, and does not include the time zone abbreviation in the output.
&DISPDATE=FormatDateTime(SHIP_DATE, SHIP_TZ, False);