close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Datepicker and DB insert 0000-00-00

Thread began 7/20/2016 7:53 am by tony | Last modified 7/22/2016 9:24 am by Ray Borduin | 2204 views | 5 replies |

tony

Datepicker and DB insert 0000-00-00

Hi all,
strange things are happening here.
The inserted db value related to the datepicker field is always 0000-00-00.
So, I changed the insert db binding value from:

<?php echo ((isset($_POST["data_scontrino_reg"]))?$_POST["data_scontrino_reg"]:""); ?>

to

<?php echo ((isset($_POST["data_scontrino_reg"]))?date('Y-m-d',strtotime($_POST["data_scontrino_reg"])):""); ?>

But now the inserted value is in the wrong format:

yyyy-dd-mm

instead of the required one:

yyyy-mm-dd


AAARHGHHHH!

Please note the datepicker format is specified in the datepicker UI is dd/mm/yyyy.

Can you help me to fix this?

TIA

tony

Sign in to reply to this post

Ray BorduinWebAssist

Change the datepicker format to use: dd-mm-yyyy

php automatically recognizes slash separated as US format with month first, but will treat dash separated dates as day first.

Sign in to reply to this post
Did this help? Tips are appreciated...

tony

Originally Said By: Ray Borduin
  Change the datepicker format to use: dd-mm-yyyy

php automatically recognizes slash separated as US format with month first, but will treat dash separated dates as day first.  


Hi Ray,
Thanks for your reply, it works.
But is there a way to use the format dd/mm/yyyy?
TIA

tony

Sign in to reply to this post

Ray BorduinWebAssist

You could replace slashes with dashes in the binding instead like:

<?php echo ((isset($_POST["data_scontrino_reg"]))?date('Y-m-d',strtotime(str_replace("/","-",$_POST["data_scontrino_reg"]))):""); ?>

Sign in to reply to this post
Did this help? Tips are appreciated...

tony

Originally Said By: Ray Borduin
  You could replace slashes with dashes in the binding instead like:

<?php echo ((isset($_POST["data_scontrino_reg"]))?date('Y-m-d',strtotime(str_replace("/","-",$_POST["data_scontrino_reg"]))):""); ?>  



Thanks for this reply,
but I can't find a way to make WA server validation works between datepicker and date/time server validation.
Here is my setup:

Datepicker: validation date 03.png
WA date/time validation 1:validation date 01.png
WA date/time validation 2:validation date 02.png

But validation ALWAYS fails, whatever date I insert.

Please note that the insert/bindings are now correct, thanks to your suggestion.

ANy idea?

TIA

tony

Sign in to reply to this post

Ray BorduinWebAssist

Try using US format in the min date field: 7/15/2016

Also do the same replacement in the server variable setting that you did for the insert:
<?php echo ((isset($_POST["data_scontrino_reg"]))?str_replace("/","-",$_POST["data_scontrino_reg"]):""); ?>

Sign in to reply to this post
Did this help? Tips are appreciated...

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...