I want user to enter a date. Using a form, and in the background convert this to number of days. Then desuct a certain number of days, then convert that back to a date.
Example:
Enter the date you were born.
— convert to xx amount of days (dateindays)
Then make newtotal=dateindays-280
convert newtotal to a date.
Can anyone point me in the right direction of doing this, or do they know some function for doing this?
So lets say :user enters date 13th July 1980
We use js to convert this to total number of days 11,453 days
Then create new function : subtotal=11453-280
And convert those number of days into a date, and echo back on screen.
Then use the following link to format it:
http://www.webdevelopersnotes.com/tips/html/10_ways_to_format_time_and_date_using_javascript.php3
Thanks to this SO question for the link:
Where can I find documentation on formatting a date in JavaScript?