close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

DataAssist datepicker date to db help needed

Thread began 3/20/2012 8:05 pm by jurinski334466 | Last modified 3/25/2012 11:22 am by jurinski334466 | 3361 views | 8 replies

Jason ByrnesWebAssist

the mysql database date column expects to receive the date formatted as yyyy-mm-dd. you will reformat the selections that where made to that format.


to do this:
1) make sure the value of the Year select list is a 4 digit year:
<option value="1990">1990</option>

2) make sure the value of the Month select list is the 2 digit month, not the month name:
<option value="01">January</option>

3) make sure the value of the day select list is the 2 digit day number:
<option value="01">1</option>

4) add a hidden form element to the page, but don't set a value for it.

5) add code to line 1 of the page to format the date, assuming the form element names are "year", "month", "day", "fullDate" (hidden element), the code to use would look like this:

php:
<?php if($_SERVER['REQUEST_METHOD'] == "POST"$_POST["fullDate"] = date("Y-m-d"strtotime($_POST["year"]."/".$_POST["month"]."/".$_POST["day"])); ?>



6) in the insert record behavior, bind the date column to the fullDate hidden element which will contain the formatted date.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...