| Index
» Projects
» phpMyEdit
» Forum
» Date formats - still no good solution |
 |
b1gman
Joined: 12 Oct 2005
Posts: 5
Posted: 2006-02-18 03:07
Back to top
Reply with quote
|
Im in UK and need dates to display in dd/mm/YYYY format,
I originally used sql and sqlw to manipulate the date so that it displayed and could be input in the format I need.
However, the sorting options then stop working and PME stops sorting the date fields.
So now I have added the jscalendar, and datemask which is all fine except for when you add/update a date field - the field is still shown as YYYY-MM-DD format.
Any news on a fix for this please?
|
ajh
Joined: 17 Dec 2003
Posts: 236
Posted: 2006-02-18 23:06
Back to top
Reply with quote
|
YYYY-MM-DD is how MySQL displays the date format, so it's not a bug. If you want to display it in another way you need to manipulate it using sql/sqlw
|
mkrz
Joined: 02 May 2006
Posts: 1
Posted: 2006-05-02 17:32
Back to top
Reply with quote
|
I think I have finally found a satisfying solution. As the first poster stated, if you use sql options, you cannot sort the listing by date properly anymore. If you use a datemask on a field instead, this is ignored on add/change. So, here's the solution:
- use datemask for display
- use sql option ONLY FOR ADD/CHANGE
- use sqlw option to format locale-specific dates in the format sql needs on writing.
Here's an example (with German date format):
| Code: |
$opts['fdd']['EventDate'] = array(
'name' => 'Datum',
'select' => 'T',
'maxlen' => 10,
'sort' => true,
'options' => 'AVCL',
'default' => date("d.m.Y", strtotime("now")),
'datemask' => "d.m.Y",
'sql|AC' => "DATE_FORMAT(EventDate, '%d.%m.%Y')",
'sqlw' =>
"CONCAT_WS('-',
SUBSTRING_INDEX(" . '$val_qas' . ",'.',-1),
SUBSTRING_INDEX(SUBSTRING_INDEX(" . '$val_qas' . ",'.',2), '.', -1 ),
SUBSTRING_INDEX(" . '$val_qas' . ",'.', 1)
)"
); |
Note the "|AC" after "sql". I've only just implemented it, but it seems to work - now you have locale-specific dates on LIST/ADD/EDIT *and* correct sorting on LIST.
For other date formats, you will have to adapt the sql/datemask/sqlw options, but there are several already several posts here with examples.
Hope this helps.
|
Denver Dave
Joined: 02 Feb 2003
Posts: 19
Posted: 2006-05-02 23:54
Back to top
Reply with quote
|
I setup a JavaScript date picker, which helped lower the complaints from users. Unfortunately, the version that I'm using works only in I.E., but there probably are FireFox versions out there.
|
ajh
Joined: 17 Dec 2003
Posts: 236
Posted: 2006-05-05 06:54
Back to top
Reply with quote
|
Have a look at the mcecal extension for PME. It includes a javascript date picker which works with IE and Mozilla-based browsers.
|
Denver Dave
Joined: 02 Feb 2003
Posts: 19
Posted: 2006-05-07 18:40
Back to top
Reply with quote
|
Where might we find the extensions? I love phpmyedit and it might be just me, but I've always found the web material difficult to navigate and find, the mcecal extension being no exception. I've looked on the platon.sk website as well as phpmyedit.org and also did a google search for mcecal without success. I think I've seen the extensions before, but can't seem to find them now.
I did finally find:
http://opensource.platon.sk/cvs/cvs.php/phpMyEdit/extensions/
but still have no idea how to get here with a link from a public page.
|
ajh
Joined: 17 Dec 2003
Posts: 236
Posted: 2006-05-08 13:04
Back to top
Reply with quote
|
The extensions are only published in the CVS, so you will need to go there to download them. If you download the mce_cal class:
http://opensource.platon.sk/cvs/cvs.php/phpMyEdit/extensions/phpMyEdit-mce-cal.class.php
, you will see the instructions on how to use it in the comments at the beginning. Note that you will also need to download jscalendar - instructions in the extension file as well.
Extensions are documented in the documentation.
By the way...you can get to the CVS by choosing
CVS Browser
from the left hand navigation.
|
|
Post new topic
Reply to topic
|
|
|
|