Home  >  Article  >  Web Front-end  >  Moment.js is an awesome Javascript date processing library not to be missed_javascript skills

Moment.js is an awesome Javascript date processing library not to be missed_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:54:201328browse

Using this class library can help you process related dates effectively. Hope you all like it!

Main features:
3.2kb ultra-lightweight
Independent class library, which means you don’t need to pour in a bunch of js
Date processing supports UNIX timestamp, String, specified format Date
Date processing: adding, subtracting dates
Date display: including date display options for relative time display
Other built-in functions, such as saving, timezone offset and i18n support
can be used as node. A module of js
Complete documentation introduction

How to use it?

Copy code The code is as follows:

var now = moment();
console. log(now.format('dddd, MMMM Do YYYY, h:mm:ss a'));

Copy code The code is as follows:

ar halloween = moment([2011, 9, 31]); // October 31st
console.log(halloween.fromNow());

Copy code The code is as follows:

var now = moment(). add('days', 9);
console.log(now.format('dddd, MMMM Do YYYY'));

Copy code The code is as follows:

var now = moment(); moment.lang('fr');
console.log(now.format ('LLLL'));


moment_jb51.rar Package download
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn