Skip to content

Instantly share code, notes, and snippets.

@Devendra0110
Created June 12, 2020 08:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Devendra0110/e75454d08fe36610e2d97b1861f06b5d to your computer and use it in GitHub Desktop.
Save Devendra0110/e75454d08fe36610e2d97b1861f06b5d to your computer and use it in GitHub Desktop.
test moment object in local and utc format
var moment = require("moment")
// format the current date
var now = moment();
console.log(now.format("YYYY-MM-DDTHH:mm:ss.SSS[Z]"))
console.log(moment(now.format("YYYY-MM-DDTHH:mm:ss.SSS[Z]")).diff("2020-06-27T07:24:41.690Z"))
console.log(now.diff("2020-06-27T07:24:41.690Z"))
// moment API
moment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment