Caché SQL Reference
SYSDATE
[Back] [Next]
   
Server:docs2
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

A date/time function that returns the current local date and time.
Synopsis
SYSDATE
Description
SYSDATE takes no arguments and returns the current local date and time for this timezone. It adjusts for local time variants, such as Daylight Saving Time.
SYSDATE returns time in whole second increments. The SYSDATE function is very similar to the CURRENT_TIMESTAMP function, with the exception that CURRENT_TIMESTAMP supports an optional precision argument that enables it to return fractional seconds.
The CURRENT_TIMESTAMP function is preferred for use in Caché SQL. The SYSDATE function is provided for compatibility with other versions of SQL. Refer to CURRENT_TIMESTAMP for further details.
Note that all Caché SQL time and date functions except GETUTCDATE are specific to the local time zone setting. To get a current timestamp that is universal (independent of time zone) you can use GETUTCDATE or the Caché ObjectScript $ZTIMESTAMP special variable.
The following example shows that SYSDATE and CURRENT_TIMESTAMP are equivalent functions:
SELECT SYSDATE AS SysStamp,
       CURRENT_TIMESTAMP AS TStamp
 
The following example shows the use of CURRENT_TIMESTAMP with a precision argument to return fractional seconds:
SELECT SYSDATE AS SysStamp,
       CURRENT_TIMESTAMP(2) AS TStamp
 
See Also