The parse() method creates a DayPilot.Date object from a string using a custom date format pattern.
This is a static method. Call it using the full DayPilot.Date.parse() prefix. It can't be invoked on a DayPilot.Date instance.
Declaration
DayPilot.Date.parse(input, pattern[, locale])Parameters
input(string) - text to be parsedpattern(string) - date format patternlocale(string or DayPilot.Locale object) - locale used for parsing, especially full month names.Locale.USis used if not specified.
Pattern Syntax
yyyy- full yearyy- shortened yearmm- minutes using two digitsm- minutes using one or two digitsd- day number using one or two digitsdd- day number using two digitsddd- shortened day of week namedddd- full day of week nameHH- hours using two digits in 24-hour clock formatH- hours using one or two digits in 24-hour clock formatss- seconds using two digitss- seconds using one or two digitsMMMM- full month nameMMM- shortened month nameMM- month number using two digitsM- month number using one or two digits
Return Value
Returns a DayPilot.Date object if parsing succeeds; otherwise null.
Example
const date = DayPilot.Date.parse("12/31/2016", "M/d/yyyy");See Also
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot