close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

datepicker format

Thread began 12/21/2010 3:55 pm by CraigR | Last modified 11/16/2011 11:51 am by Jason Byrnes | 7310 views | 29 replies |

CraigRBeta Tester

datepicker format

i have added a datepicker to my dataassist, wizard created insert record page, to replace the standard date field.

i would like to format the date field so that it reads dd/mm/yyyy on screen, but is saved as yyyy-mm-dd for insertion in my mysql database.

if i choose dd/mm/yyyy in my datepicker properties, no date value is inserted

Sign in to reply to this post

Dave BuchholzBeta Tester

Craig,

use this function and wrap the date in the insert behaviour with it

php:
function i8_formatUKDateMySQL($date) {

$d = str_replace(" ","",$date);
$d = explode('/', $date);
$d = $d[2].'-'.$d[1].'-'.$d[0];
return $d;
}
Sign in to reply to this post

CraigRBeta Tester

Thanks for the function Dave, it works a treat.

Much appreciated.



...But should the extension be able to do this out of the box ?

Sign in to reply to this post

Dave BuchholzBeta Tester

Craig,

DataAssist, which I am assuming you are using, handles US style dates out of the box but for UK style dates I have always had to use an external function.

Sign in to reply to this post

CraigRBeta Tester

Hi Dave.

Yeah, I'm aware of the US centric thing, its just that I was under the impression that all dates saved to a MYSQL database table were saved as YYYY-MM-DD format anyway.

i hoped that choosing the format on the wizard would change the date format for the screen view, but the save format would remain.

Sign in to reply to this post

Dave BuchholzBeta Tester

No it doesn't work like that, there is a function as part of the data assist helper file that converts US dates as a matter of course but it doesn't work on uk dates

Sign in to reply to this post

CraigRBeta Tester

I didn't know that.

I'll take a look.

Thanks again

Sign in to reply to this post

CraigRBeta Tester

Not working with US dates either

On my confirm.php page on my ecart based site, i have added a datepicker for the customer to select a date.

the date is formatted on the page as mm-dd-yyyy

the date value is stored as a session variable, and is required as part of the 'eCart store cart summary in database' server behavior.

However the date is in the wrong format to store in the database natively.

is it necessary to reformat the date by hand coding ?

(not difficult to do, but is there another way with US format dates)

Sign in to reply to this post

Jason ByrnesWebAssist

Yes, you will need to use hand coding to convert the date to the format that us expected by he database.

Sign in to reply to this post

CraigRBeta Tester

thanks Jason.

i'm creating a nice set of 'useful' functions

Sign in to reply to this post
loading

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