简体   繁体   中英

Get current date + x Months in Epoch format

For the validation of a form i need to calculate the current date + 3 months and compare it to the value THE client inputted in the form.

Hoe to retrieve the current date plus 3 months in epoch.

I know i retrieve the current date by : (new Date).getTime()

Thanks!

I Found the solution:

(new Date).setMonth((new Date).getMonth()+3 

this wil generate the epoch month with three months from the current date!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM