close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Change date format and validation

Thread began 7/09/2012 12:17 am by info4753 | Last modified 7/12/2012 1:13 pm by info4753 | 2269 views | 6 replies |

info4753

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

Sign in to reply to this post

Jason ByrnesWebAssist

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:

php:
<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:

php:
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:

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

Sign in to reply to this post

info4753

This post has been deleted.

info4753

With this solution I still get an 'invalid format' validation error when I change the date in the date picker.

Sign in to reply to this post

Jason ByrnesWebAssist

send a copy of your page please.

Sign in to reply to this post

info4753

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

Attached Files
news_update.php.zip
Sign in to reply to this post

Jason ByrnesWebAssist

the spry format:
format:'d.m.Y'


should be:
format:'dd.mm.yyyy'

Sign in to reply to this post

info4753

Thx that worked!

Sign in to reply to this post

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