加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-14 05:02:42 所属栏目:百科 来源:网络整理
导读: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

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,//设置每周的第一天为周一 });});

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读