<span id="datePickerSpan${email.id}">
<g:formatDate date="${scheduleDate}" format="dd-MM-yyyyHH:mm"/>
</span>
<input type="text" id="datePicker${email.id}" style="display:none"/>
<span onclick="openDateTimePicker('${email.id}')"></span>
<g:javascript>
var str='${scheduleDate}';//2013-02-2412:40:00.0
str = str.replace(/(\d{2}:\d{2}:\d{2}).*$/g, '$1');
alert("Str is=> "+str);//2013-02-24 12:40:00
var date2=new Date(str);
alert(" yy dd mm alert"+date2);//invalid date object
str = str.replace(/^(\d{4})-(\d{2})-(\d{2})/g, '$2-$3-$1');
alert("now new Str is =>"+str);//02-24-2013 12:40:00.0
var date=new Date(str);
alert("now str date is =>"+date);//invalid date object
var date1=new Date();
alert("java script date is =>"+date1);//Wed Feb 13 2013 11:16:55 GMT+0530 (India Standard Time)
$('#datePicker${email.id}').datetimepicker({
dateFormat: 'dd-mm-yy',
timeFormat: 'HH:mm',
minDateTime: new Date(),
maxDateTime:null,
defaultDate:new Date(),
showOn: "button",
buttonImage: requestPath + "/images/calendar.gif",
buttonImageOnly: true,
onSelect : function(dateText,obj){
saveRescheduleDate(${email.id},dateText);
}
});
</g:javascript>
问问题
132 次
2 回答
0
JavaScript Date 对象是使用 new Date() 创建的。:
new Date("02-24-2013 12:40:00.0");
于 2013-02-13T06:14:18.777 回答
0
你可以像这样声明 Date 对象
var dt= new Date("October 13, 1975 11:13:00")
试试这个链接以获得更多参考
于 2013-02-13T06:33:02.640 回答