[Version: 2024 - September]
[Build: 24.09.03003]
Converts a date string to a DateTime data type.
(string dateString)
Returns date based on passed value.
Example: ToDateTime("31-12-2024") will parse string according to current date format and return a date (December 31, 2024).
dateString: Required. The value of the date.
(string dateString, string cultureCode)
Returns date based on passed value and culture parameters.
Example: ToDateTime("31-12-2024", "da-DK") will parse string according to the Danish format and return a date (December 31, 2024).
dateString: Required. The value of the date.
(string dateString, string cultureCode, bool isSafeCast)
Returns date based on passed value and culture parameters.
Example: ToDateTime("33-33-3333", "da-DK", true) fails with conversion error and returns a default value of the date (January 1, 0001).
dateString: Required. The value of the date.
(string dateString, string cultureCode, bool isSafeCast, datetime defaultValue)
Returns date based on passed value and culture parameters.
Example: ToDateTime("33-33-3333", "da-DK", true, date(2024, 12, 31)) fails with conversion error and returns a default value of the date (December 31, 2024).
dateString: Required. The value of the date.
Examples
The two DateStrings are formatted as strings in Excel ('31-12-2024 and '01-04-2024). The Danish "da-DK" culture format has been used in this case:
Link to list of culture formats: Culture formats
Comments
Please sign in to leave a comment.