Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1320
  • Last Modified:

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?
1 Solution
Date functions emulated in Javascript

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now