advlegals
asked on
javascript Date() to MySQL datetime data type
I have one of those commonly used popup calendars on a page that is working fine. It uses the following:
<input type="hidden" name="ticket_deadline_date " value="2006-04-28 00:00:00" />
<input type="text" name="deadline_date" value="04/28/06" class="text" readonly size="12"/>
I would like to change the values of both via a javascript function that will be triggered by a select option. The "hidden" value is for writing to MySQL with a data type of datetime. The over form element is for display to the user. I am pretty decent with javascript, but I don't know how to take "2006-04-20 00:00:00" and add 5 days to it, for example. This would change the value to "2006-04-25 00:00:00" and the other value to "04/25/06".
I haven't found a lot of flexibility in the javascript Date() object.
Is this possible?
<input type="hidden" name="ticket_deadline_date
<input type="text" name="deadline_date" value="04/28/06" class="text" readonly size="12"/>
I would like to change the values of both via a javascript function that will be triggered by a select option. The "hidden" value is for writing to MySQL with a data type of datetime. The over form element is for display to the user. I am pretty decent with javascript, but I don't know how to take "2006-04-20 00:00:00" and add 5 days to it, for example. This would change the value to "2006-04-25 00:00:00" and the other value to "04/25/06".
I haven't found a lot of flexibility in the javascript Date() object.
Is this possible?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.