js日期转换工具

var dq = new Date();//定义当前时间
var sDueDate = formatDate(dq);/调用日期转换方法 传入当前时间
//进行日期转换
function formatDate(now) { debugger
var year = now.getFullYear(); var month = now.getMonth() + 1; var date = now.getDate()-10; var hour = now.getHours(); var minute = now.getMinutes(); var second = now.getSeconds(); return year + "-" + month + "-" + date; }

猜你喜欢

转载自www.cnblogs.com/Ai-Hen-Jiao-zhi/p/10113470.html