Moment.js is a simple tiny JavaScript library that assists us with parsing, formatting and manipulating date values.

Using the Moment.js JavaScript library usually involves with calling the moment() function that returns a reference for a new object that represents the current time.

The code shown in this video clip is available below. Make sure you fix the relative links to the required JavaScript file.

<!DOCTYPE html>
<html>
<head>
    <title>Moment.js Jump Start</title>
    <script type="text/javascript" src="moment.js"></script>
</head>
<body>
    <script type="text/javascript">
        document.writeln("<br/>"+moment().format('MMMM Do YYYY, h:mm:ss a'));
        document.writeln("<br/>"+moment().add('days', 1).calendar());
    </script>
</body>
</html>

You can find slides and video clips that explain how to use this library in my free courses website at http://abelski.lifemichael.com.

Leave a Reply

Your email address will not be published. Required fields are marked *