Monday, March 30, 2009

JavaScript: Copy to a Date var

1.First you start with the Date object you want to copy; let's call that "d1".
2.Create a new Date object where you want to copy the value to, say "d2":
"var d2 = new Date()".
3.Call "setTime" on the new variable and pass in the "valueOf()" of your source date: "d2.setTime(d1.valueOf())".

No comments: