Search code examples
javascriptvalidationdatetimeepoch

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!


Solution

  • I Found the solution:

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

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