Date/Time Values (Tools/APIs)
Available Tools
The tools are grouped into the following categories: data type classes and tools to work with date/time values.
Available Data Type Classes
Class Name | Logical Value | ODBC Type | XSD Type |
---|---|---|---|
%DateOpens in a new tab | A date value in $HOROLOG format (see Current Date and Time). For example: 46674 | DATE | date |
%TimeOpens in a new tab | A time value, expressed as the number of seconds past midnight. For example: 67080 | TIME | time |
%TimeStampOpens in a new tab | A date value and a time value, in ODBC format (in YYYY-MM-DD HH:MM:SS.nnnnnnnnn). For example: 1968-10-15 18:38:47 | TIMESTAMP | dateTime |
%UTCOpens in a new tab | A UTC date and time value, in ODBC format. | TIMESTAMP |
Availability: All namespaces.
Available Tools for Working With Date/Time Values
Includes the TimeZone() class method.
Availability: All namespaces.
Includes class methods that you can use to work with date/time values. These include:
-
A large set of methods that implement SQL functions to extract date parts (DAYOFWEEK(), MONTHNAME(), YEAR(), and so on). You can use these methods in the same way that you use other class methods; you are not restricted to an SQL context.
-
Methods that implement SQL date conversion functions (CONVERT(), TODATE(), and TOTIMESTAMP())
-
Methods that add and subtract dates (DATEADD() and DATEDIFF())
Availability: All namespaces.
Includes the following class methods that you can use to convert or obtain information about date/time values:
-
IsDST()
-
LocalWithZTIMEZONEtoUTC()
-
UTCtoLocalWithZTIMEZONE()
Availability: All namespaces.
Provides a set of class methods for working with %TimeStampOpens in a new tab values. These are as follows:
-
Compare()
-
ConvertHorologToTimeStamp()
-
ConvertUTCtoLocal()
-
LogicalToOdbc()
-
And others
Availability: All namespaces.
Note
The special variable $SYSTEM is bound to the %SYSTEM package. This means that instead of ##class(%SYSTEM.class).method(), you can use $SYSTEM.class.method().