How to Use Date Sub Seconds using Node Js?

Hello Friends,
Now let's see example of how to use date sub seconds example. We will check how to use date sub seconds. This is a short guide on use date sub seconds in node js. Let's get started with how to use date sub seconds in node js.
Here i will give you many example how to use date sub seconds using node js.
Example 1 :
Step 1 : Create Node AppRun following command to create node app.
mkdir my-app cd my-app npm initStep 2 : Create server.js file
server.js
var dtSecond; dtSecond = new Date('2021-11-19 10:50:20'); console.log(dtSecond.getSeconds()); dtSecond.setSeconds(dtSecond.getSeconds() - 10); console.log(dtSecond.getSeconds());
now you can simply run by following command:
node server.jsOutput :
20 10
Example 2 :
Step 1 : Create Node AppRun following command to create node app.
mkdir my-app cd my-app npm initStep 2 : Create server.js file
server.js
var dtSecond; dtSecond = new Date('2021-12-25 10:25:48'); console.log(dtSecond.getMinutes() + ':' + dtSecond.getSeconds()); dtSecond.setSeconds(dtSecond.getSeconds() - 10); console.log(dtSecond.getMinutes() + ':' + dtSecond.getSeconds());
now you can simply run by following command:
node server.jsOutput :
25:48 25:38
It will help you...