The util.Datetime class / util.Datetime methods |
Converts a string to a DATETIME value according to a format specification.
util.Datetime.parse( src STRING, fmt STRING ) RETURNING res DATETIME q1 TO q2
The util.Datetime.parse() method parses a string according to a format specification, to produce a DATETIME value.
The format specification must be a combination of place holders such as %Y, %m, %d, etc.
The precision of the resulting DATETIME value depends on the format specification. For example, when using "%y-%m-%d %H:%M", the resulting value will be a DATETIME YEAR TO MINUTE.
The method returns NULL, if the source string cannot be converted to a DATETIME value according to the format specification.
For more details about the supported formats, see Formatting DATETIME values.
IMPORT util MAIN DEFINE dt DATETIME YEAR TO MINUTE LET dt = util.Datetime.parse( "2014-12-24 23:45", "%Y-%m-%d %H:%M" ) DISPLAY dt END MAIN