Link to home
Start Free TrialLog in
Avatar of Isaac
IsaacFlag for United States of America

asked on

add days to Date

Hi All,

Has anybody ever used moment before? http://momentjs.com/

It seems like an easy way to manipulate dates.
I am trying to add days to a date I get from a sharePoint list but it's not working like I expect.
i think my syntax is wrong and I can't find anything on their site about how to do this.

function getCumuVal(dte)
{
	alert(dte);
	var nextDate = moment().add('days', 6).calendar(dte);
	alert("nxDte: "+nextDate);
}

Open in new window


The first alert shows the date being passed in but then the 2nd alert shows this..
"nxDte: Thursday at 11:17 AM".
It shows that for all the dates.

When I tried it this way
var nextDate = moment(dte).add('days', 6);

Open in new window

My alert produced the folllwoing: "1349841600000" but the values were different for each date


Any ideas or how I can add 6 days to any date?

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Isaac

ASKER

Excellent!!!

Thanks!