Samuel
Samuel

Reputation: 1406

Getting value of specific time in next week

I am trying to get the value of next week ( + 7 days) at 09:00. I can get the Date using

 new Date().setDate(new Date().getDate() + 7)

For example, it returns: 1619343639426

which translates to

new Date(1619343639426)
Sun Apr 25 2021 15:10:39 GMT+0530 (India Standard Time)

I want to get the value for Sun Apr 25 2021 09:00:00 GMT+0530 (India Standard Time)

how to do that ?

Upvotes: 0

Views: 41

Answers (1)

Shashank Vivek
Shashank Vivek

Reputation: 17504

Try

new Date(new Date().setDate(new Date().getDate() + 7)).setHours(9, 0, 0, 0)

Upvotes: 2

Related Questions