Tags:
create new tag
, view all tags

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

TWiki version: TWikiRelease04x01x02
TWiki plugins:  
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories: Documentation

-- DanielGermann - 17 Nov 2008

Answer

ALERT! 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

 
Change status to:
Topic revision: r2 - 2008-11-18 - PeterThoeny
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.