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

ted · 2013年05月01日 · 最后由 luikore 回复于 2013年05月01日 · 2036 次阅读

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

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

或者用 i18n-js

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

需要 登录 后方可回复, 如果你还没有账号请 注册新账号