DayPilot.Date.parse

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 parsed

  • pattern (string) - date format pattern

  • locale (string or DayPilot.Locale object) - locale used for parsing, especially full month names. Locale.US is used if not specified.

Pattern Syntax

  • yyyy - full year

  • yy - shortened year

  • mm - minutes using two digits

  • m - minutes using one or two digits

  • d - day number using one or two digits

  • dd - day number using two digits

  • ddd - shortened day of week name

  • dddd - full day of week name

  • HH - hours using two digits in 24-hour clock format

  • H - hours using one or two digits in 24-hour clock format

  • ss - seconds using two digits

  • s - seconds using one or two digits

  • MMMM - full month name

  • MMM - shortened month name

  • MM - month number using two digits

  • M - 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:

LitePro
DayPilot for JavaScript