The %PosixTime data type class represents a time stamp value.
The logical value of the %PosixTime data type is the number of seconds since (or before) January 1, 1970 00:00:00, encoded as a 64-bit integer.
The encoding takes the Posix Time, multiplies by 1000000, and adds 2^60.
To decode a %PosixTime in to Posix Time, take the logical %PosixTime value, subtract 2^60, and divide by 1000000.
While this makes the logical value of %PosixTime a bit unwieldy to deal with by itself, it does make the logical value non-ambiguous when also dealing with %Date and %TimeStamp logical values.
%PosixTime takes up less disk space and memory than %TimeStamp datatype, and is better for performance than %TimeStamp.
The earliest date supported by %PosixTime is 0001-01-01 00:00:00, which has a logical value of -6979664624441081856.
The last date supported is 9999-12-31 23:59:59.999999, which has a logical value of 1406323805406846975.
Dates prior to 1970-01-01 00:00:00 have a negative logical value. 6 digits of precision are supported for the %PosixTime value.
The format specification for the data type's date component display value.
The value of the DATEFORMAT parameter corresponds to the
available parameters of the $ZDATETIME and $ZDATETIMEH function's fformat value,
which is used to perform the formatting of the time component of the timestamp value.
parameter INDEXNULLMARKER = -1E19;
Declares the default null marker value to use in index subscripts for properties of type %PosixTime
parameter JSONTYPE = number;
JSONTYPE is JSON type used for this datatype.
parameter MAXVAL = 1406323805406846975;
The maximum allowed logical value for the data type. By default, a Logical value of 1406323805406846975, which is 9999-12-31 23:59:59.999999.
parameter MINVAL = -6979664624441081856;
The minimum allowed logical value for the data type. By default, a logical value of -6979664624441081856, which is 0001-01-01 00:00:00.
parameter TIMEFORMAT;
The format specification for the data type's time component display value.
The value of the TIMEFORMAT parameter corresponds to the
available parameters of the $ZDATETIME and $ZDATETIMEH function's tformat value,
which is used to perform the formatting of the time component of the timestamp value.
parameter XMLTIMEZONE = UTC;
XMLTIMEZONE specifies the handling of timezone part of the XML format dateTime.
"UTC" means convert to UTC on input. "IGNORE means ignore the timezone.
parameter XSDTYPE = dateTime;
Declares the XSD type used when projecting XML Schemas.
classmethod DisplayToLogical(%val As %RawString) as %PosixTime [ Language = objectscript ]
Converts the input value %val, which represents a display timestamp value, in a logical %PosixTime value.
classmethod IsValid(%val As %RawString) as %Status [ Language = objectscript ]
Tests if the logical value %val, which represents a %PosixTime value, is valid.
Input value of a valid %TimeStamp logical value or %Date ODBC value is also allowed. If %TimeStamp logical value or %Date ODBC value is given, it will first be converted to a %PosixTime value
The validation is based on the class parameter settings used for the class attribute this data type is associated with.
In this case, MAXVAL and MINVAL.
classmethod JSONToLogical(%val As %BigInt) as %PosixTime [ Language = objectscript ]
Converts the JSON UNIX time to logical %PosixTime.
Converts a logical %PosixTime value to a Unix time value (number of seconds before or after 01 Jan 1970 00:00:00.000000).
classmethod LogicalToXSD(%val As %PosixTime) as %String [ Language = objectscript ]
Converts the %PosixTime value to the canonical SOAP encoded value.
classmethod Normalize(%val As %RawString) as %PosixTime [ Language = objectscript ]
Converts %val to a normalized %PosixTime value.
Input value of a valid %TimeStamp logical value or %Date ODBC value is also allowed. If %TimeStamp logical value or %Date ODBC value is given, it will first be converted to a %PosixTime value