DayPilot.Date.toDate

The toDate() method returns a Date object that holds the DayPilot.Date value as UTC time.

Declaration

DayPilot.Date.toDate()

Return Value

Returns a Date object that represents the DayPilot.Date value as UTC time.

Notes

The returned object preserves the same UTC timestamp stored by DayPilot.Date. As shown in the example below, calling toISOString() on the result produces the original ISO value.

Example

const today = DayPilot.Date.today();            // DayPilot.Date {value: "2018-01-01T00:00:00"}
const todayString = today.toString();          // "2018-01-01T00:00:00"

const utcToday = today.toDate();               // Mon Jan 01 2018 01:00:00 GMT+0100 (Central European Standard Time)
const utcTodayString = utcToday.toISOString(); // "2018-01-01T00:00:00.000Z"

See Also

DayPilot.Date.toDateLocal()

DayPilot.Date Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript