parseDate
parseDate( format, value, settings )
Extract a date from a string value with a specified format.
The format can be combinations of the following:
- d - day of month (no leading zero)
- dd - day of month (two digit)
- o - day of year (no leading zeros)
- oo - day of year (three digit)
- D - day name short
- DD - day name long
- m - month of year (no leading zero)
- mm - month of year (two digit)
- M - month name short
- MM - month name long
- y - year (two digit)
- yy - year (four digit)
- @ - Unix timestamp (ms since 01/01/1970)
- ! - Windows ticks (100ns since 01/01/0001)
- '...' - literal text
- '' - single quote
- anything else - literal text
A number of exceptions may be thrown:
- 'Invalid arguments' if either
format
orvalue
is null - 'Missing number at position nn' if
format
indicated a numeric value that is not then found - 'Unknown name at position nn' if
format
indicated day or month name that is not then found - 'Unexpected literal at position nn' if
format
indicated a literal value that is not then found - 'Invalid date' if the date is invalid, such as '31/02/2007'
Arguments:
format | String | |
---|---|---|
The format to use in extracting the date. | ||
value | String | |
The date value to be examined. | ||
settings | Object | |
This is an (optional) object with the following attributes: shortYearCutoff (Number) the value (0-99) beyond which years are considered to be in the previous century - used in conjunction with the 'y' format option; dayNamesShort (String[7]) the short names for the days of the week, starting at Sunday; dayNames (String[7]) the long names for the days of the week, starting at Sunday; monthNamesShort (String[12]) the short names for the months of the year; monthNames (String[12]) the long names for the months of the year. All values default to the datepicker defaults which is usually standard English. |
Examples: