How to: |
HGETZ provides the current Coordinated Universal Time (UTC/GMT time, often called Zulu time). UTC is the primary civil time standard by which the world regulates clocks and time.
The value is returned in the desired date-time format. If millisecond or microsecond values are not available in your operating environment, the function retrieves the value zero for these components.
HGETZ(length, output)
where:
Integer
Is the length of the returned date-time value. Valid values are:
Date-time
Is the returned date-time value.
This example,
HGETZ(8, 'HYYMDS')
creates a timestamp representing the current date and time.
The time zone can be calculated as a positive or negative hourly offset from GMT. Locations to the west of the prime meridian have a negative offset. The following request uses the HGETC function to retrieve the local time, and the HGETZ function to retrieve the GMT time. The HDIFF function calculates the number of boundaries between them in minutes. The zone is found by dividing the minutes by 60:
DEFINE FILE EMPLOYEE LOCALTIME/HYYMDS = HGETC(8, LOCALTIME); UTCTIME/HYYMDS = HGETZ(8, UTCTIME); MINUTES/D4= HDIFF(LOCALTIME, UTCTIME, 'MINUTES', 'D4'); ZONE/P3 = MINUTES/60; END TABLE FILE EMPLOYEE PRINT EMP_ID NOPRINT OVER LOCALTIME OVER UTCTIME OVER MINUTES OVER ZONE IF RECORDLIMIT IS 1 END
The output is:
LOCALTIME 2015/05/12 12:47:04 UTCTIME 2015/05/12 16:47:04 MINUTES -240 ZONE -4
WebFOCUS | |
Feedback |