DHTMLX Docs & Samples Explorer

getFormatedDate(format, date)

Returns formatted date.

Parameters:

  • format - the custom date format string. If the parameter is omitted, the currently set date format will be used.
  • date - the date you want to apply the specified format to. If the parameter is omitted, the currently selected date will be used.

    myCalendar.getFormatedDate("%d/%m/%y", "2011-06-08")

Description:

Format string can contain any separator character and any element from the following list:

  • %d - day as number ( with leading zero );
  • %j - day as number;
  • %D - abbreviated name of the day;
  • %l - full name of the day;
  • %m - month as number ( with leading zero );
  • %n - month as number;
  • %M - abbreviated name of the month;
  • %F - full name of the month;
  • %y - year as number (2 digits);
  • %Y - year as number (4 digits);
  • %h - hours (12);
  • %H - hours (24);
  • %i - minutes;
  • %s - seconds;
  • %a - am or pm;
  • %A - AM or PM.

For example, if you want to return 1st June 2011 as 01.06.2011, you should use the following code:

myCalendar.getFormatedDate("%d.%m.%Y", "2011-06-01")

See also: