Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get unix timestamp from tomorrow nodejs

I want to get Unix timestamp (time in seconds) from tomorrow.

I have tried the following with no success:

var d = new Date();
d.setDate(d.getDay() - 1);
d.setHours(0, 0, 0);
d.setMilliseconds(0);
console.log(d/1000|0)

How would I fix the above?

like image 201
Ira Kloostra Nathan Avatar asked Nov 07 '22 18:11

Ira Kloostra Nathan


1 Answers

Just modified your code and it works fine

var d = new Date();
d.setDate(d.getDate() + 1);
d.setHours(0, 0, 0);
d.setMilliseconds(0);
console.log(d)
>> Sun Apr 21 2019 00:00:00 GMT+0530 (India Standard Time)

Hope this will work for you

like image 198
Dupinder Singh Avatar answered Nov 10 '22 00:11

Dupinder Singh