DayPilot.Date.toString

DayPilot.Date.toString()

Returns the string representation created using toStringSortable() - in ISO8601 format.

DayPilot.Date.toString(pattern [,locale])

Returns the string formatted using the pattern (and locale).

Pattern elements:

  • yyyy - full year: 2013
  • MMMM - full month name string: January
  • MMM - short month name string: Jan
  • MM - two-digit month number: 01
  • M - month number: 1
  • dddd - day of week string: Monday
  • ddd - short day of week string: Mo
  • dd - two-digit day of month number: 09
  • d - day of month number: 9
  • HH - two-digit hours, 24-hour clock: 23
  • H - hours, 24-hour clock: 23
  • hh - two-digit hours, 12-hour clock: 11
  • h - hours, 12-hour clock: 11
  • tt - AM/PM string
  • mm - two-digit minutes: 08
  • m - minutes: 8
  • ss - two-digit seconds: 07
  • s - seconds: 7

Example patterns:

  • "MM/dd/yyyy": 12/31/2013
  • "dd.MM.yyyy": 31.12.2013

When locale is specified, the output uses the day names and month names defined by the locale (for "dddd" and "MMMM").

Examples

new DayPilot.Date("2013-12-31T13:30:00").toString("MM/dd/yyyy");

  • "12/31/2013"

new DayPilot.Date("2013-12-31T13:30:00").toString("dddd d MMMM yyyy", "es-es");

  • "martes 31 diciembre 2013"

DayPilot for JavaScript, ASP.NET WebForms, ASP.NET MVC, Java