js日期转换工具
Posted ai-hen-jiao-zhi
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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; }
以上是关于js日期转换工具的主要内容,如果未能解决你的问题,请参考以下文章