DHTMLX Docs & Samples Explorer

getFormatedDate(format, date)

Returns formatted date as string.

Parameters:

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

    var d = myCalendar.getFormatedDate("%d/%m/%y"); // date selected in calendar
    // or
    var d = myCalendar.getFormatedDate("%d/%m/%y", new Date()); // for today

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.

See also: