更新时间:2022-06-23 20:29:46
日期:2012/02/20 来源:GBin1.com
moment.js是一个轻量级并且健壮的js日期处理类库,相信大家在javascript开发过程中,都自己动手写过,或者使用google和百度搜索过相关的实现函数。使用这个类库,可以帮助你有效的处理相关日期。希望大家喜欢!
var now = moment();
console.log(now.format('dddd, MMMM Do YYYY, h:mm:ss a'));
var halloween = moment([2011, 9, 31]); // October 31st
console.log(halloween.fromNow());
var now = moment().add('days', 9);
console.log(now.format('dddd, MMMM Do YYYY'));
var now = moment(); moment.lang('fr');
console.log(now.format('LLLL'));