Possible Duplicate:
How to calculate the number of days between two dates using JavaScript?
I wonder with the current date, how can I get the age in days. For example at date 12/4/1995 returned 6435.
Is there any library function that does this?
Possible Duplicate:
How to calculate the number of days between two dates using JavaScript?
I wonder with the current date, how can I get the age in days. For example at date 12/4/1995 returned 6435.
Is there any library function that does this?
You can compose two dates and subtract them. The result will be in milliseconds, so you have to convert that to days:
var days = (new Date() - new Date(1995, 11, 4)) / (1000 * 60 * 60 * 24);
// (today) (then) (milliseconds per day)
You can then round days
(and as appropriate.