You are viewing the documentation for Blueriq 18. Documentation for other versions is available in our documentation directory.

DATETIME


Converts a value of another data type into a datetime. 


Syntax

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

When no format is specified, the ISO-8601 datetime format (yyyy-MM-dd hh:mm:ss) is used for converting values to datetime values, following the principle from most to least significant. We recommend specifying an explicit datetime format in your conversion function to ensure clarity and avoid confusion.
The system default time zone (local time) is applied when converting the dateTime string. Converting time between different time zones involves various factors, such as daylight saving time and regional differences, which can be complex. Currently, Blueriq does not have built-in functions for performing these time zone calculations, so we recommend using a custom service for accurate time zone conversion.


Return type

  • date


String to datetime examples

  • DATETIME("22-07-2024 16:38:40", "dd-MM-yyyy hh:mm:ss) converts the string "22-07-2024 16:38:40" in a datetime value.
  • DATETIME("20240722 16.38.40", "yyyyMMdd hh.mm.ss") converts the string "20240722 16.38.40" in a datetime value. 

Date to datetime example

  • Assume we have a date attribute Person.DateOfBirth
    DATETIME(Person.DateOfBirth) converts the date value to a datetime value by extending the date value with the timestamp 00:00:00.

Note

The way in which date and time values are displayed in the UI is determined by the date and time display formats, which can be configured per language code. For example the Dutch nl-NL date format could be configured as "dd-MM-yyyy hh:mm:ss", whereas the English en-US date format can be defined as "MM/dd/yyyy hh.mm.ss".
The converted date time in our example could look like "22-07-2024 16:38:40" when displayed in Dutch (nl-NL) and like "07/22/2024 16.38.40" when displayed in English (en-US).
More information about language specific formats can be found in Reference Guide: Language formats.


38:40Back to Top