🌐
Node.js
nodejs.org › en › blog › announcements › evolving-the-nodejs-release-schedule
Node.js — Evolving the Node.js Release Schedule
4 days ago - Starting with 27.x, Node.js will move from two major releases per year to one. This post explains what's changing, why, and what it means for users. For the full discussion and background, see nodejs/Release#1113.
🌐
W3Schools
w3schools.com › js › js_dates.asp
W3Schools.com
February 4, 2026 - Date objects are static.
Discussions

Where does Date object come from?
It's attached to the globalThis, which is the global-object in the context of a Node process and the window in the case of a browser. Date is just a shorthand reference for globalThis.Date, global.Date or window.Date. Read more . More on reddit.com
🌐 r/node
25
10
August 27, 2023
How to format a UTC date as a `YYYY-MM-DD hh:mm:ss` string using NodeJS?
@EmmanuelMericdeBellefon, still, the question is related to NodeJs, not NextJs. 2024-04-23T02:06:23.933Z+00:00 ... I have nothing against libraries in general. In this case a general purpose library seems overkill, unless other parts of the application process dates heavily. More on stackoverflow.com
🌐 stackoverflow.com
light-date ⏰ - Blazing fast & lightweight (173 bytes) date formatting for Node.js and the browser.
Nice job! I just read this and it blew my mind, didn’t know the browser could do a lot of formatting as well nowadays (yours seems to have a different usecase, but still nice to know about): https://reactgo.com/format-date-time-javascript/ More on reddit.com
🌐 r/node
16
111
September 3, 2019
Up to date docker? How to run a Monero node on a NAS
https://github.com/leonardochaia/docker-monerod https://hub.docker.com/r/lchaia/monerod I would recommend you don't trust me and build it yourself after reviewing the Dockerfile. There's also a Dockerfile on Monero's repository https://github.com/monero-project/monero/blob/master/Dockerfile More on reddit.com
🌐 r/Monero
8
11
December 28, 2018
🌐
Bitstack
blog.bitsrc.io › how-to-slash-through-node-js-date-comparison-pitfalls-43d7939b0d06
How to Slash Through Node.js Date Comparison Pitfalls
November 12, 2024 - If you ask me the best format for dates, I would say ISO 8601. It is both widely used and unambiguous. Using the ISO format (YYYY-MM-DDTHH:MM:SSZ) ensures consistency in the stored data, making it easier to compare across different systems.
🌐
DEV Community
dev.to › srashtigupta › mastering-date-time-manipulation-in-javascript-nodejs-mh
Mastering Date & Time Manipulation in JavaScript (Node.js) - DEV Community
March 12, 2025 - In this article, we’ll explore several JavaScript Date methods that can help you handle timestamps, compare expiration times, and work with dates effectively.
🌐
date-fns
date-fns.org
date-fns - modern JavaScript date utility library
date-fns provides the most comprehensive yet simple and consistent toolset for manipulating JavaScript dates in a browser & Node.js.
🌐
Bugfender
bugfender.com › blog › javascript-date-and-time
The Definitive Guide to JavaScript Date and Time | Bugfender
February 18, 2025 - Explore the JavaScript Date object in our detailed guide. Learn to compute and format dates, and delve into the APIs essential for modern app development.
Find elsewhere
🌐
npm
npmjs.com › package › date-fns
date-fns - npm
Modern JavaScript date utility library. Latest version: 4.1.0, last published: a year ago. Start using date-fns in your project by running `npm i date-fns`. There are 24996 other projects in the npm registry using date-fns.
      » npm install date-fns
    
Published   Sep 17, 2024
Version   4.1.0
🌐
GeeksforGeeks
geeksforgeeks.org › node.js › node-js-date-format-api
Node.js Date.format() API - GeeksforGeeks
January 8, 2025 - NodeJS HTTP2 · Last Updated : 8 Jan, 2025 · The date-and-time.Date.format() is a minimalist collection of functions for manipulating JS date and time module which is used to format the date according to a certain pattern. Required Module: Install the module by npm or used it locally.
🌐
GitHub
github.com › datejs › Datejs
GitHub - datejs/Datejs: A JavaScript Date and Time Library · GitHub
Datejs is an open source JavaScript Date library for parsing, formatting and processing.
Starred by 1.9K users
Forked by 473 users
Languages   JavaScript 97.7% | HTML 1.8% | CSS 0.5%
🌐
freeCodeCamp
freecodecamp.org › news › how-to-format-a-date-with-javascript-date-formatting-in-js
How to Format a Date with JavaScript – Date Formatting in JS
November 7, 2024 - In this article, we'll explore various techniques to format dates in JavaScript, enabling you to present dates in your desired format for your application.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Temporal
Temporal - JavaScript | MDN
The Temporal object enables date and time management in various scenarios, including built-in time zone and calendar representation, wall-clock time conversions, arithmetics, formatting, and more. It is designed as a full replacement for the Date object.
🌐
Medium
medium.com › diving-into-development › building-a-simple-api-with-node-js-javascript-dates-b9a615816b6d
Building a simple API With Node.js & JavaScript Dates | by Shaina Karasin | Diving into Development | Medium
May 31, 2017 - To solve requirements #4–5, we’ll build our outputs as JavaScript objects in the required formats. To access the pieces and formats of the time that we need, we’ll use JavaScript’s built-in Date methods on our date object.
🌐
Node.js
nodejs.org › en › about › previous-releases
Node.js — Node.js Releases
Node.js® is a free, open-source, cross-platform JavaScript runtime environment that lets developers create servers, web apps, command line tools and scripts.
🌐
NestJS
docs.nestjs.com › techniques › task-scheduling
Documentation | NestJS - A progressive Node.js framework
Nest is a framework for building efficient, scalable Node.js server-side applications. It uses progressive JavaScript, is built with TypeScript and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming).
Top answer
1 of 16
731

If you're using Node.js, you're sure to have EcmaScript 5, and so Date has a toISOString method. You're asking for a slight modification of ISO8601:

new Date().toISOString()
> '2012-11-04T14:51:06.157Z'

So just cut a few things out, and you're set:

new Date().toISOString().
  replace(/T/, ' ').      // replace T with a space
  replace(/\..+/, '')     // delete the dot and everything after
> '2012-11-04 14:55:45'

Or, in one line: new Date().toISOString().replace(/T/, ' ').replace(/\..+/, '')

ISO8601 is necessarily UTC (also indicated by the trailing Z on the first result), so you get UTC by default (always a good thing).

2 of 16
135

UPDATE 2021-10-06: Added Day.js and remove spurious edit by @ashleedawg
UPDATE 2021-04-07: Luxon added by @Tampa.
UPDATE 2021-02-28: It should now be noted that Moment.js is no longer being actively developed. It won't disappear in a hurry because it is embedded in so many other things. The website has some recommendations for alternatives and an explanation of why.
UPDATE 2017-03-29: Added date-fns, some notes on Moment and Datejs
UPDATE 2016-09-14: Added SugarJS which seems to have some excellent date/time functions.


OK, since no one has actually provided an actual answer, here is mine.

A library is certainly the best bet for handling dates and times in a standard way. There are lots of edge cases in date/time calculations so it is useful to be able to hand-off the development to a library.

Here is a list of the main Node compatible time formatting libraries:

  • Day.js [added 2021-10-06] "Fast 2kB alternative to Moment.js with the same modern API"
  • Luxon [added 2017-03-29, thanks to Tampa] "A powerful, modern, and friendly wrapper for JavaScript dates and times." - MomentJS rebuilt from the ground up with immutable types, chaining and much more.
  • Moment.js [thanks to Mustafa] "A lightweight (4.3k) javascript date library for parsing, manipulating, and formatting dates" - Includes internationalization, calculations and relative date formats - Update 2017-03-29: Not quite so light-weight any more but still the most comprehensive solution, especially if you need timezone support. - Update 2021-02-28: No longer in active development.
  • date-fns [added 2017-03-29, thanks to Fractalf] Small, fast, works with standard JS date objects. Great alternative to Moment if you don't need timezone support.
  • SugarJS - A general helper library adding much needed features to JavaScripts built-in object types. Includes some excellent looking date/time capabilities.
  • strftime - Just what it says, nice and simple
  • dateutil - This is the one I used to use before MomentJS
  • node-formatdate
  • TimeTraveller - "Time Traveller provides a set of utility methods to deal with dates. From adding and subtracting, to formatting. Time Traveller only extends date objects that it creates, without polluting the global namespace."
  • Tempus [thanks to Dan D] - UPDATE: this can also be used with Node and deployed with npm, see the docs

There are also non-Node libraries:

  • Datejs [thanks to Peter Olson] - not packaged in npm or GitHub so not quite so easy to use with Node - not really recommended as not updated since 2007!
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date
Date - JavaScript | MDN
JavaScript Date objects represent a single moment in time in a platform-independent format. Date objects encapsulate an integral number that represents milliseconds since the midnight at the beginning of January 1, 1970, UTC (the epoch).