» » Use moment.js to manage the date and time easily

 

Use moment.js to manage the date and time easily

Author: bamboo06 on 25-10-2014, 08:29, views: 2598

6
javascript everyone in the development of front-end processing date and time will encounter problems, often brought a lot of handlers to complete a simple date and time display. Today I will give you a lightweight javascript date processing library: moment.js, with which you can easily solve the problem of front-end development for various date and time encountered.
moment.js not rely on any third-party libraries, support string, Date, time stamp, and an array of other formats, can be like PHP's date () function, the date and time formatting, calculation of relative time, access to a specific date and time after time, etc. and so on, this article has the following examples.
Formatting Date
Current time:
moment().format('YYYY-MM-DD HH:mm:ss'); //2014-09-24 23:36:09 

The day of the week
moment().format('d'); //3 

Convert Unix timestamp current time
moment().format('X'); 

Relative Time
20120901 relative to the current date is two years ago
moment("20120901", "YYYYMMDD").fromNow(); //2 years ago 

7 days after the date
moment().add('days',7).format('YYYY-MM-DD'); //2014-10-01 

9 hours after now
moment().add('hours',9).format('HH:mm:ss'); 

moment.js provides a wealth of documentation, you can use it to create complex projects, such as the date and time the application calendar.
For more information about moment.js presentation, please visit the project's official website: http: //momentjs.com/

Category: Javascript

Dear visitor, you are browsing our website as Guest.
We strongly recommend you to register and login to view hidden contents.
<
  • 0 Comments
  • 0 Articles
18 September 2017 23:14

Lydia

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
Thanks for the quality information here. I am the top dissertation writing help uk person in the world right now and each one of these articles you're writing is so good to read.

<
  • 0 Comments
  • 0 Articles
26 September 2017 03:11

Ilvveto

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
Thanks for telling us about this moment thing. I need to get the best drone for gopro now and everything will be good for me. Keep doing stuff like this.

<
  • 0 Comments
  • 0 Articles
13 January 2018 23:02

Kolkata Escorts

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
Beauti Queen amazing kolkata escorts agency alwyas ready for you at your doorstep. Beauti Queen provide you high profile independent girl in kolkata, escorts service in kolkata, kolkata escorts. If you are looking for the ultimate encounter in Kolkata then I am your sophisticated young Kolkata escorts that provides upscale companionship for making your night becomes true.
escorts service in kolkata, kolkata escorts, escorts in kolkata, independent escorts in kolkata, female escorts in kolkata

<
  • 0 Comments
  • 0 Articles
2 February 2018 07:07

Kolkata Escorts

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
Renu Das Kolkata Escorts Services has gorgeous females provides Independent Escorts Service in Kolkata call girls at 100% satisfaction with VIP models. Provided Kolkata escorts at our agency are professional in nature and are eager to serve you at your place.
kolkata escorts, escorts in kolkata, escorts service in kolkata, female escorts in kolkata, escorts agency in kolkata, independent escorts in kolkata

<
  • 0 Comments
  • 0 Articles
26 February 2018 13:35

tape measurer

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
Mini Cute Cartoon 150cm 60 Inch tape measure uk Plush Retractable Tape Measure Ruler Sewing tape measurer Tool,Retractable Metric/ Feet/ Inches 10'/ 16'/ 25' Measuring Tape Measure laser measure Tool,Retractable Body Measuring Ruler Sewing Cloth Tailor tape measure Tape Measure Soft 60" 1.5M.

<
  • 0 Comments
  • 0 Articles
1 March 2018 04:11

Delhi Escorts

Reply
  • Group: Guests
  • РRegistered date: --
  • Status:
 
Riya Chaudhary is an Independent Delhi Escort girl, who offers dazzling hot Delhi Escorts Service, incall or outcall services both to complete your dreams in real entertainment. We offers high class Independent Escorts in Delhi at Riya Chaudhary Delhi Escorts service agency for elite peoples in the city to avail ultimate satisfaction. you can spend your beautiful moments.
delhi escorts, independent escorts in delhi, escorts in delhi, female escorts in delhi, escorts service in delhi

Information
Comment on the news site is possible only within (days) days from the date of publication.