JavaScript 为获取该格式 (2013-04-28 22:22:53) 的时间,js 这般写发是不是太麻烦了? 请问有其他简便方法吗?

ted · May 01, 2013 · Last by luikore replied at May 01, 2013 · 2037 hits

var today = new Date(); today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDay() + ' ' + today.getHours() + ':' + today.getMinutes() + ':' + today.getSeconds()

除了自己写个 function 外还其他内置简单譬如 format 的方法吗?

moment.js

或者用 i18n-js

i18n-js 和 moment 的区别是,i18n-js 用的 unix date 时间格式,配合 rails i18n 只用维护一种时间格式...

You need to Sign in before reply, if you don't have an account, please Sign up first.