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

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM