close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

How to format DatePicker date to dd/mm/yyyy so that it displays correctly in the form field and is validated correctly?

Thread began 12/09/2013 8:56 am by FPhu61701534 | Last modified 12/10/2013 8:50 am by FPhu61701534 | 12348 views | 6 replies

FPhu61701534

How to format DatePicker date to dd/mm/yyyy so that it displays correctly in the form field and is validated correctly?

I understand that MySQL stores date in Y-m-d H:i:s format. However, I want to generate dates based on dd/mm/yyyy and display in this format in the form field once the date is picked (and validated as dd/mm/yyyy). Unfortunately, it doesn't work. I tried all the methods described in the other threads but still can't get it work. I experimented with different permutations and ended up getting invalid format warning, incorrect format or 1/1/1970.

Can you advise what I should do? I have run out of idea how to make this work. Here are the codes in questioned:

DatePicker...
$(function(){
$('#session_date_start').datepicker({
changeMonth: true,
changeYear: true,
dateformat: "dd/mm/yy",
onClose: closeDatePicker_session_date_start
});

Form Field...
<input id="session_date_start" name="session_date_start" type="text" value="<?php echo((isset($_GET["invalid"])?ValidatedField("sessionupdate","session_date_start"):"".(($row_WADAsession["session_date_start"])?date("d/m/Y",strtotime($row_WADAsession["session_date_start"])):"")."")); ?>" class="formTextfield_Medium" tabindex="4" onBlur="hideServerError('session_date_start_ServerError');">
});

Spry Validation...
var session_date_start_Spry = new Spry.Widget.ValidationTextField("session_date_start_Spry", "date",{ format:'dd/mm/yyyy' , validateOn:["blur"]});

Attached is the php file. The problematic field is: session_date_start. Once this issue is solved, I will replicate the correct formatting to the other date fields.

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