Change date format and validation
I can't find a way to change the date format, its validation and database insert/update from 07/02/2012 to 02.07.2012 (mm/dd/yyyy to dd.mm.yyyy).
Thx for any help in advance
I can't find a way to change the date format, its validation and database insert/update from 07/02/2012 to 02.07.2012 (mm/dd/yyyy to dd.mm.yyyy).
Thx for any help in advance
the database will store the date using the format Y-m-d h:m:s
to enter and display the date in a differant formation, you will need to edit the code on the page.
for example, on the update page, the code for a date picker element will be:
<input id="ProductEndDate" name="ProductEndDate" type="text" value="<?php echo((isset($_GET["invalid"])?ValidatedField("productsupdate","ProductEndDate"):"".(($row_WADAProducts["ProductEndDate"])?date("m/d/Y",strtotime($row_WADAProducts["ProductEndDate"])):"")."")); ?>" class="formTextfield_Medium" tabindex="11" onBlur="hideServerError('ProductEndDate_ServerError');">
this portion of the code:
date("m/d/Y",strtotime($row_WADAProducts["ProductEndDate"]))
displays the date using m/d/Y as the format. to change the format to dd.mm.yyyy the code would be:
date("d.m.Y",strtotime($row_WADAProducts["ProductEndDate"]))
to change the format used by the date picker element, select it in design view, and click the edit button in the property inspector, you can edit the format used in the date picker settings.
With this solution I still get an 'invalid format' validation error when I change the date in the date picker.
send a copy of your page please.
I have also formatted the spry validation to:
var newsdatum_Spry = new Spry.Widget.ValidationTextField("newsdatum_Spry", "date",{ format:'d.m.Y' , validateOn:["blur"]});
So all dates look like: 30.12.2012
But I still receive an "Invalid format." error on validation. I've attached the page
the spry format:
format:'d.m.Y'
should be:
format:'dd.mm.yyyy'
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
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.