var curr_time = new Date();
var strDate = curr_time.getFullYear()+"-";
strDate += curr_time.getMonth()+1+"-"; //0-11
strDate += curr_time.getDate()+" ";
strDate += curr_time.getHours()+":";
strDate += curr_time.getMinutes()+":";
strDate += curr_time.getSeconds();
$("#sqrq").datetimebox("setValue", strDate);
本文介绍了一种使用JavaScript进行日期和时间格式化的实用方法。通过创建一个当前日期的实例,然后获取年、月、日、小时、分钟和秒,并将它们拼接成指定格式的字符串,最后设置到页面元素中。
1941

被折叠的 条评论
为什么被折叠?



