Below my working code
var dateString = $('#startdatetime').val();
var reggie = /(\d{2})-(\d{2})-(\d{4}) (\d{2}):(\d{2})/;
var dateArray = reggie.exec(dateString);
var d = new Date((+dateArray[3]),(+dateArray[2])-1,(+dateArray[1]),(+dateArray[4]),(+dateArray[5]));
d.setHours(d.getHours() + 1);
var endTime = ((d.getDate()<10?'0':'') + d.getDate())+"-"+(((d.getMonth() + 1)<10?'0':'') +(d.getMonth() + 1) )+"-"+d.getFullYear()+" "+((d.getHours()<10?'0':'') + d.getHours())+":"+((d.getMinutes()<10?'0':'') + d.getMinutes());
$('#enddatetime').handleDtpicker('setDate', new Date(d));
Hi,
Kinldy fix this error and update this setDate() function issue. Thanks.
ERROR CONSOLE LOG : jquery.simple-dtpicker.js:1004 Uncaught TypeError: Cannot read property '0' of undefined
Below my working code var dateString = $('#startdatetime').val(); var reggie = /(\d{2})-(\d{2})-(\d{4}) (\d{2}):(\d{2})/; var dateArray = reggie.exec(dateString); var d = new Date((+dateArray[3]),(+dateArray[2])-1,(+dateArray[1]),(+dateArray[4]),(+dateArray[5])); d.setHours(d.getHours() + 1); var endTime = ((d.getDate()<10?'0':'') + d.getDate())+"-"+(((d.getMonth() + 1)<10?'0':'') +(d.getMonth() + 1) )+"-"+d.getFullYear()+" "+((d.getHours()<10?'0':'') + d.getHours())+":"+((d.getMinutes()<10?'0':'') + d.getMinutes()); $('#enddatetime').handleDtpicker('setDate', new Date(d));
Regards, MSK