close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

display uk date - datepicker

Thread began 1/25/2010 2:18 pm by dylan399236 | Last modified 2/23/2010 3:16 pm by mr hankey | 3658 views | 21 replies |

dylan399236

display uk date - datepicker

Hi all.
Just subscribed to the library and am looking for short guide on how to have datepicker display UK format date, then submit to DB in standard MySQL DATE format.

I can create a css form.
Have got date picker working within PHP page but cannot get it to display DD/MM/YYYY.
DB field is set to DATE.

I have seen the REFORMAT option within the VALIDATION TOOLKIT but am not sure of order to do things and am not having any luck.

Can someone tell me the settings I need to use? I realise I can muck about with hand-coding str_to_date() but that's not why I bought into Webassist :) (i did look through the forum).

Hoping the support is going to make up for my initial disappointment in the way the WA extensions are tied together (am used to Interakt/ADDT)!

Thanks,
Dylan.

Sign in to reply to this post

Dani Chankhour

there is a couple of changes that you will need to make, but we should be able to change the format.

First, look for this line of code:

changeMonth: true,
changeYear: true,

and change it to:

changeMonth: true,
changeYear: true,
dateFormat: 'dd/mm/yy',


the second thing is changing the spry validation. at the bottom of your page, look for a string 'mm/dd/yyyy' and change it to 'dd/mm/yyyy'


this should allow you to have UK date format.

Sign in to reply to this post

dylan399236

Many thanks Dani

I'll give that a go when I get back home from the day job.

Dylan.

Sign in to reply to this post

mr hankey

thanks for that, i was looking for this solution also, works fine.

one thing though, how do i change the years to show olderas in for a date of birth? when i add this it shows from year 2000?

many thanks

Sign in to reply to this post

Dani Chankhour

I was not able to find a way to change it to display a year less than 2000.

here is the page the list the options that you can add or modify of the datepicker:

#option-maxDate

Sign in to reply to this post

mr hankey

thanks dani,

i found this line of code but what file and where do you edit it?

:
Control the range of years displayed in the year drop-down: either relative to current year (-nn:+nn) or absolute (nnnn:nnnn).

Code examples
Initialize a datepicker with the yearRange option specified.
$('.selector').datepicker({ yearRange: '2000:2010' });Get or set the yearRange option, after init.
//getter
var yearRange = $('.selector').datepicker('option', 'yearRange');
//setter
$('.selector').datepicker('option', 'yearRange', '2000:2010');

thanks

Sign in to reply to this post

Dani Chankhour

good work.

You can add this line of code:

yearRange: '1980:2020',

right under this line, which you added:

dateFormat: 'dd/mm/yy',

Sign in to reply to this post

mr hankey

thanks dani

Sign in to reply to this post

neilo

Cheers for that Mr H and Dani.

Sign in to reply to this post

dylan399236

Hi Dani

Sorry for going AWOL after my post but was unwell for couple of days.

Your solution is only partially working for me. The date is now displayed in UK format dd/mm/yyyy after using datepicker and I get no validation errors when submitting but the date is in the database as 0000-00-00

Bit confused as it seems to have worked for mr hankey!

Thanks.
Dylan.


I've attached as a txt file if you could see what's going on(or what I'm missing)?
This was with a fresh PHP file, adding fresh CSS form with 3 fields

Attached Files
test.txt
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...