微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

easyui时的时间格式yyyy-MM-dd与yyyy-MM-ddd HH:mm:ss

easyui日期的转换,日期汉化导入:<script type="text/javascript" src="../easyui/locale/easyui-lang-zh_CN.js"></script>

重写我们想要的格式:

1这种返回yyyy-MM-dd HH:mm:ss

 

$(function(){
$(‘.easyui-datetimeBox‘).datetimeBox({
formatter: function (date) {
var day = date.getDate() > 9 ? date.getDate() : "0" + date.getDate();
var month = (date.getMonth() + 1) > 9 ? (date.getMonth() + 1) : "0" + (date.getMonth() + 1);
var hor = date.getHours();
var min = date.getMinutes();
var sec = date.getSeconds();
return date.getFullYear() + ‘-‘ + month + ‘-‘ + day+" "+hor+":"+min+":"+sec;
}
});
});
2这种返回yyyy-MM-dd
$(function () {
$(‘.easyui-dateBox‘).dateBox({
formatter: function (date) {
// //格式化
return date.getFullYear() + ‘-‘ + (date.getMonth() + 1) +
‘-‘ + date.getDate();
return date;
},
parser: function (s) {
// return new Date(2015,6,1);

}
});
//获得日历控件
$(".easyui-dateBox").dateBox(‘calendar‘).calendar({
firstDay: 1,//设置每周的第一天为周一 });});

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐