Question
I haven't managed to find out how to format the date. It could be a whole wiki setting or even a simple form attribute, anything would do it.
I need to change it to "yyyymmdd", so that it can correctly sort the field's column in a search over the forms.
Thanks.
Environment
--
DanielGermann - 17 Nov 2008
Answer
If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.
You can change dates into a sortable format using
SpreadSheetPlugin formulas. First, convert a date into a serialized format, then convert it back to a format of choice. Here is an example of changing "28 May 2012" into a sortable format:
%CALC{$FORMATTIME($TIME(28 May 2012), $year-$month-$day)}%
Which returns: 2012-05-28
You can put the CALC into the SEARCH format parameter. Assuming you have a form field called "Deadline" containing a date you can specify this format:
format="| .... | $percntCALC{$FORMATTIME($TIME($formfield(Deadline)), $year-$month-$day)}$percnt | ... |"
Please note that you need to escape the % of the CALC in order to have it executed once per search hit.
You can pre-sort a table by using TABLE variable.
See details in
VarSEARCH,
FormattedSearch,
SpreadSheetPlugin,
TablePlugin
--
PeterThoeny - 18 Nov 2008