moment js cdn code example

Example 1: momentjs cdn

<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.25.1/moment.min.js"></script>

Example 2: angularjs cdn

<!doctype html>
<html ng-app>
  <head>
    <title>My AngularJS App</title>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>
  </head>
  <body>
  </body>
</html>

Example 3: moment format

moment().format('MMMM Do YYYY, h:mm:ss a'); // September 30th 2020, 2:48:17 pm
moment().format('dddd');                    // Wednesday
moment().format("MMM Do YY");               // Sep 30th 20
moment().format('YYYY [escaped] YYYY');     // 2020 escaped 2020
moment().format();                          // 2020-09-30T14:48:17+02:00

Example 4: momentjs

npm install moment --save   # npm
yarn add moment             # Yarn
Install-Package Moment.js   # NuGet
spm install moment --save   # spm
meteor add momentjs:moment  # meteor
bower install moment --save # bower (deprecated)

Tags:

Html Example