Get Current Date time in Node.js
Get Current Date time in Node.js : You can retrive the current date time in Node.js using Date object. Here in this tutorial we are going to explain how to get current date time in Node.js
Get Current Date time in Node.js
Use the following syntax for getting the current date time –
Get Current Date time in Node.js:
var currdatetime = new Date(); console.log(currdatetime); |
The above syntax will give the current date time.
For the newer browsers you can also use the following method quickly-
Node.js Syntax to Get Current Date time:
var currtime = Date.now(); console.log(currdatetime); |
The above syntax will also give the current date time in milliseconds.
Advertisements