Hi,
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);
myForm.load('CheckForm.do')
var mydp = new dataProcessor ("CheckForm.do");
mydp.init(myForm);
myForm.attachEvent(“onButtonClick”, function(id){
if(id==“save”){
myForm.save();
alert(“saved”);
}
}
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…