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 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.

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 "14 May 2026" into a sortable format:

%CALC{$FORMATTIME($TIME(14 May 2026), $year-$month-$day)}%

Which returns: 2026-05-14

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:
Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2008-11-18 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.