Toggle menu


A library for parsing, validating, manipulating, and formatting dates.

This library is distributed under the MIT license, its source is (opens new window). For full documentation see (opens new window).




var moment = require('moment');

Moment.js provides powerful tools for manipulating dates and times. It also has tools to handle local time, UTC and fixed time zone offsets, date formatting. The documentation for moment is exceptionally good, meaning there is little need to reproduce it here. Introductory concepts are found at (opens new window).


Get the date and time in a particular format.

function( params, credentials ) {
    var moment = require('moment');
    var now = moment().format('MMMM Do YYYY, h:mm:ss a');
    return now;

    "jsonrpc": "2.0",
    "id": 217,
    "result": "September 28th 2016, 11:30:34 am"


The has also been included. To use this verion:

var moment = require('moment-timezone');

Last modified on 21 April 2023

Share this page

Facebook icon Twitter icon email icon


print icon