Problem in saving a calendar date


i am using a calendar component integrated in a form, and i want to save the Date in the database…
but i am having a problem with date format…

here is my code…

ormData = [
{ type:“input” , name:“ID”, label:“ID”, position:“” },
{ type:“calendar” , name:“DOB”, label:“dhxCalendar”, dateFormat:“%d-%m-%Y”, position:“” },
{ type:“calendar” , name:“DOJ”, label:“dhxCalendar”, dateFormat:“%d-%m-%Y”, position:“” },
{ type:“button” , name:“add”, value:“Add”, position:“” },
{ type:“button” , name:“save”, value:“Save”, position:“” },
{ type:“button” , name:“prev”, value:“Prev”, position:“” },
{ type:“button” , name:“next”, value:“Next”, position:“” }

		var myForm = new dhtmlXForm("box",formData);
		var mydp = new dataProcessor ("");

myForm.attachEvent(“onButtonClick”, function(id){

when i click the save button it saves the date in the database tables as follows

Thu Mar 01 2012 15:36:00 GMT+0530 (IST)
Fri Mar 02 2012 15:36:00 GMT+0530 (IST)

but i want to save in this format only

2012-03-01(year - month - date)
2012-03-02(year - month - date)
i also used the SetDateFromat();
dateformat: in calendar component

help me how to store the date in the back end in specific format…

Please, see this topic: viewtopic.php?f=7&t=22747
Use the last attachment as an example


   i used the code in the referenced link, it adds an extra attribute serverDateFormat: %Y-%m-%d .

   but when i call the date is saved in the format

  sun sep 23 2012 11:04:00 GMT+0530(IST)

  i want to save the date in the format of %Y-%m-%d

  i am using dhtmlx 3.0 pro  in that i just include dhtmlx.js dhtmlx.css connector.js and dataprocessor.js 

tell me how could i save the date in my own format
this lib has more problem with api form clear also
i already posted many post regarding these problems help me please…

thank u…
i found the problem it is in the library, i checked the code with the library you provided me as a link

  i need a favour that i am using the dhtmlx.js ans dhtmlx.css as a single file could u please provide me the library which works correctly


the smaple code u have given me working fine because of the library u provide with the code, could u help me in providing the dhtmlx library without any mistakes…

thank u…

I have the same problem in the same configuration(with dhtmlx3.0 Suite).
serverDateFormat:"%Y%m%d" doesn’t want to save the date in the specified format, the date is always saved like a long date :Tue Mar 20 2012 13:47:00 GMT 0100

For now I use the input field link to a calendar. The date format is not one I want but I hope to find a solution to change it.

There is my useful attachment:

Please, take dhtmlxform.js & dhtmlxcalendar.js files from my attachment and replace them to your dhtmlx_std_full library. With libCompiler connect all necessary files to dhtmlx.js & dhtmlx.css.

Please, take dhtmlxform.js from my attachment and place it to your library. It is not official, but there is a fixed bug with your issue.

thank u very much darya

I’ll try this new version and if i have a problem i’ll create a new topic.

hi Dayra,

your amended files fix this problem for me - dates now save correctly to my server in the format specified.

Unfortunately it introduces a problem with combo controls - the first combo on the form gets populated correctly but after that the form has none of the data from the database so the rest of the fields are blank.

i am also having the same problem now…

flembopa, sudhakar940
Please, make and attach your complete demo to peproduce the problem

i am also having the same problem with the combo
form_calendar = [
{ type:“combo” , name:“vendor_id”, label:“Vendor”, labelWidth:“130”, labelHeight:“15”, labelAlign:“right”, inputWidth:“130”, inputHeight:“15”, readonly:true, labelLeft:“30”, labelTop:“20”, inputLeft:“168”, inputTop:“20”, position:“absolute” },
is not created when i initialized the form

var form_Calen= new dhtmlXForm(“Calendar”,form_calendar);

but the calendar is created and saved in the back end as specified format

now i am having the problem with combo

For all with combo-issue:

replace attached files - it will fix the problem
new.rar (28.6 KB)

hi darya,

  thank u......

  i am having another issue in my form i included calendar when i call the method myForm.clear() all the items value is cleared except the calendar value 

 is this issue is also solved in this attachment if not please provide me.....

hi Darya,

I have used your revised files and I can confirm that the combo boxes work as expected and the calendar control handles date format correctly.

many thanks for you assitance

see the attachment on your issue, please

calendar_empty_value.rar (50.1 KB)

hi darya,

 the sample u are provided is not working as per my reqirement...


i also include the screen shot of the output
i that

when clicked the button the the first alert box is executed after that myform.clear(), is not working and the next alert box is also not executed…

Have you replace all the files i’ve suggest you?

If so - please, make a demo to reproduce the issue.