js get current timestamp using moment.js
JavaScript[Edit]
+
0
-
0
js get current timestamp using moment.js
1 2 3 4 5 6 7 8 9const moment = require('moment'); // get current timestamp const now = moment(); console.log(now); // Example output: // Moment<2022-01-31T21:00:40+01:00>
[Edit]
+
0
-
0
js get current timestamp using moment.js
1 2 3 4 5 6 7 8 9const moment = require('moment'); // get current timestamp const now = moment().format(); console.log(now); // Example output: // 2022-01-31T21:02:17+01:00
[Edit]
+
0
-
0
js get current timestamp using moment.js
1 2 3 4 5 6 7 8 9const moment = require('moment'); // get current timestamp: const now = moment().toISOString(); console.log(now); // Example output: // 2022-01-31T20:04:41.285Z
[Edit]
+
0
-
0
js get current timestamp using moment.js
1 2 3 4 5const moment = require('moment'); const currentDate = moment.now(); console.log(currentDate); // Example output: 1643910082118