Question
I have a form that includes a date field. The user can click on the calendar icon and click on the date. When this happens the calendar pop up goes away and the date is now populated in the date field of the form. For example, the date displayes as 28 Aug 2008. How can I change it so the date displays as 2008/08/28? I tried changing the default date format in configure but it still comes out as 28 Aug 2008 in the form. Thanks for the help!
Environment
--
MichaelCarter - 28 Aug 2008
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
I think the date format is controlled by a
JSCalendarContrib. Set this in
twiki/lib/LocalSite.cfg setting:
$TWiki::cfg{JSCalendarContrib}{format} = '%Y-%m-%d';
to get sortable ISO dates such as
2026-02-16
--
PeterThoeny - 30 Aug 2008
Thank you Peter! That did the trick. I know people utilize TWiki for many different things but maybe this would be a better default date format that comes with the initial install. I prefer this format so sorting on dates is easily done. Thanks again!
--
MichaelCarter - 08 Sep 2008
I Peter's trick too: even better than changing the default format would be if the formfield date used the existing configure setting of
{DefaultDateFormat}. Then we wouldn't need this tip.
--
SeanCMorgan - 08 Sep 2008
That is what i proposed in
UseIsoDates, which was implemented with a compromise, e.g. no change in the default format to ISO date. Please open a new enhancement request to lobby for that useful change.
--
PeterThoeny - 09 Sep 2008
I'm not sure that ISO should the default, because some (mostly Americans?

) object to it. The format should only have one configuration point though. That might make it possible to be a user preference too?
The enhancement request is covered by
ConvergeDateTimeFormattingModels?
--
SeanCMorgan - 27 Sep 2008