Categories | Question details Back To List | ||
getDate does not return formatted date on dhtmlxDblCalendarObject When getting the selected date from the calendar I alway get something like "Thu Feb 21 2008 00:00:00 GMT-0600 (CDT)". I need '2008-02-21' and have set the format as below. How can I get the format I want? .... var mCal = new dhtmlxDblCalendarObject('cal_',false); mCal.leftCalendar.setOnClickHandler(function(this){setRangeDate(this,'fromDate')}); mCal.rightCalendar.setOnClickHandler(function(this){setRangeDate(this,'toDate')}); var fromDate = document.getElementById('fromDate').value; var toDate = document.getElementById('toDate').value; mCal.leftCalendar.setFormatedDate('%Y-%m-%d',fromDate); mCal.rightCalendar.setFormatedDate('%Y-%m-%d',toDate); mCal.leftCalendar.setDateFormat('%Y-%m-%d'); mCal.rightCalendar.setDateFormat('%Y-%m-%d'); mCal.draw(); ..... setRangeDate = function(calObj,elem){ var d = calObj.getDate(); document.getElementById(elem).value=d; .... } Answer posted by Support on Mar 21, 2008 03:53 Grid supports two different command calObj.getDate(); - returns javascript date object calObj.getFormatedDate(); - returns date as string in specified format Answer posted by Jeremy on Mar 21, 2008 10:34 Thanks for the prompt reply. Is the getFormatedDate function documented anywhere? I did not see in the cal API docs. Answer posted by Support on Mar 24, 2008 02:22 Please, see calendar's documentation. Try to find the "Formating date" article in the http://www.dhtmlx.com/docs/products/dhtmlxCalendar/doc/guide.html |