DATETIMEVALUE ER function

The DATETIMEVALUE function returns a DateTime value that is converted from a given text value in the specified format and in an optionally specified culture to a date/time value. For information about the supported formats, see standard and custom.

Syntax 1

DATETIMEVALUE (text, format)

Syntax 2

DATETIMEVALUE (text, format, culture)

Arguments

text: String

Text that represents the value to format.

format: String

The format of the given text. For information about the supported formats, see standard and custom.

culture: String

The culture that is used for formatting of the given text. For information about the supported cultures, see culture.

Return values

DateTime

The resulting date/time value.

Usage notes

When the culture isn't defined as an argument of the called function, the value of culture is defined by the calling context. For example, if the DATETIMEVALUE function is called by using syntax 1 in an Electronic reporting (ER) format for a FILE element that is configured to use the German culture, the conversion will be done by using the German culture. The default culture value is EN-US.

Example 1

DATETIMEVALUE ("21-Dec-2016 02:55:00", "dd-MMM-yyyy hh:mm:ss") returns 2:55:00 AM on December 21, 2016, based on the specified custom format and the default application's EN-US culture.

Example 2

DATETIMEVALUE ("21-Gen-2016 02:55:00", "dd-MMM-yyyy hh:mm:ss", "IT") returns 2:55:00 AM on December 21, 2016, based on the specified custom format and culture.

However, DATETIMEVALUE ("21-Gen-2016 02:55:00", "dd-MMM-yyyy hh:mm:ss", "EN-US") throws an exception to inform the user that the specified string isn't recognized as a valid date/time value for the specified culture.

Additional resources

Date and time functions