Skip to main content


A scalar date/time function that returns the current local time.


{fn CURTIME()}


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.


The following examples both return the current system time:


The following Embedded SQL example returns the current time. Because this time is stored in $HOROLOG format, it is returned as an integer:

  &sql(SELECT {fn CURTIME} INTO :a)
    WRITE !,"Error code ",SQLCODE }
  ELSE {
    WRITE !,"Current time is: ",a }

The following example sets the LastCall field in the selected row of the Contacts table to the current system time:

UPDATE Contacts Set LastCall = {fn CURTIME()}
  WHERE Contacts.ItemNumber=:item

See Also

FeedbackOpens in a new tab