Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Panel
bgColorwhite

DATETIME


Converts a value of another data type into a datetime. 


Syntax

Code Block
DATETIME(string value, [format])
DATETIME(date value)


Inputs

  • value - The value of the data type that is converted to datetime. 

  • format (optional) - The format used for conversion. Format must be enclosed by quotes, e.g. “yyyy-MM-dd hh:mm:ss”. For more info on specifying datetime format patterns, please see Date and time formats or patterns


Default formats

For all conversion functions that use a string as parameter, the [format] describes the format in which the input string value parameter is in. When not specifying a format, by default this format is used: 

string to datetime -

When the format is omitted the ISO-8601 date time format yyyy-MM-dd hh:mm:ss (Most to least significant principle) is used for converting the value to a dateTime
However we advice to use an explicit dateTime format in your conversion function to avoid any confusion about the format used for conversion.


Return type

  • date


Examples

  • DATETIME("202122-0207-18 122024 16:5538:34") results in a datetime value of 18-02-2021 12:55:34 (default format is used). 40", "dd-MM-yyyy hh:mm:22) converts the string "22-07-2024 16:38:40" in a dateTime value.
  • DATETIME("20240722 16:38:40", "yyyyMMdd hhDATETIME("19861221 12:02:56", "yyyyMMdd HH:mm:ss")  results converts the string "20240722 16:38:40" in a datetime value of 21-12-1986 12:02:56 (specified format is used). dateTime value. 

38:40

Back to top