Quantcast
Channel: Adobe Community : Popular Discussions - JavaScript
Viewing all articles
Browse latest Browse all 12130

Adding Month to Date

$
0
0

I'm trying to figure out how I can add a month properly to the date from a text field. I can add days (30, 90, 180)  but I need it in months (accounting for  leap year and such)

So if the date is 7/14/15 then i need it to be 8/14/15 and such

I am doing this 3 different ways

1 month

3 months

6 months

 

this is the code i have for the days.

 

var sDate = this.getField("InvDate").value; // get date string
var oDate = util.scand("mmm dd, yyyy", sDate); // convert to object
oDate.setDate(oDate.getDate() + 90); // add 90 days to date

 

 

Any Assistance is greatly appreciated.


Viewing all articles
Browse latest Browse all 12130

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>