Description
CURTIME returns the current local time as data type TIME. It takes no argument; note that the argument parentheses are optional. CURTIME returns the current local time for this timezone; it adjusts for local time variants, such as Daylight Saving Time.
CURTIME in Logical mode returns the current local time in $HOROLOG format; for example, 37065. CURTIME in Display mode returns the current local time in the default format for the locale; for example, 10:18:27.
Hours are represented in 24-hour format.
To change the default time format, use the SET OPTION command with the TIME_FORMAT and TIME_PRECISION options.
To return just the current time, use CURTIME or CURRENT_TIME. These functions return their values in TIME data type. The CURRENT_TIMESTAMP, GETDATE and NOW functions can also be used to return the current date and time as a TIMESTAMP data type.
Note that all InterSystems 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 ObjectScript $ZTIMESTAMP special variable.
These data types perform differently when using embedded SQL. The TIME data type stores values as integers in $HOROLOG format (as the number of seconds since midnight); when displayed in SQL they are converted to time display format; when returned from embedded SQL they are returned as integers. A TIMESTAMP data type stores and displays its value in the same format. You can use the CAST or CONVERT function to change the data type of times and dates.