Algosim documentation: ParseDate

ParseDate

Parses a string as a date.

Syntax

Description

ParseDate(s) attempts to parse the string s as a date and returns, if successful, this date as a Date structure. The function assumes that the fields of the date are specified in the year, month, day (ymd) order, but does not care about the separators used to delimit these fields. However, the number of numeric fields must be exactly equal to three, and the fields must represent a valid date.

ParseDate(s, order), where order is one of "ymd", "ydm", "myd", "mdy", "dmy", "dym", "ym", "my", and "y", parses s as a date assuming the fields specified in order, in the specified order.

ParseDate(s) is equivalent to ParseDate(s, "ymd"). If not specified, the day defaults to 1 and the month to 1.

Examples

ParseDate("2025-04-13")
year: 2025
month: April
day: 13
ParseDate("13/4 2025", "dmy")
year: 2025
month: April
day: 13
ParseDate("4/13/2025", "mdy")
year: 2025
month: April
day: 13
ParseDate("2025-04-32")
failure
Incompatible date string "2025-04-32".
Call stack: ParseDate
ParseDate("2025-04", "ym")
year: 2025
month: April
day: 1

See also