Tags:
create new tag
, view all tags

Question

I modified the BugsContrib pages in order to use them for a specific task within our corp. One of the things I had to change was the format dates were displayed when displaying search results. The default format of $data and $createdate is a signature style date(20 Jul 2006). What I wanted was simply to format those dates to an iso standard. Pretty simple for $date, I simply used $isodate. However for an unknown reason I wasn't able to find such thing for $createdate. I decided to search around for a way to convert my $createdate into an iso format. Turns out CALC was a good way to do it. So I tried

%CALC{"$FORMATTIME(TIME($createdate), $year-$month-$day)"}%
It does return a date, but the current time. Why you ask? because FORMATTIME format current time when no value is used. That's where my problem lies. TIME($createdate) retruns either nothing or 0. I figured out maybe the date format wasn't supported, but it is: if I do TIME(19 Jul 2006 - 19:39) it will return me the serialized string for this time stamp. My other thought was maybe TWiki parses the spreadsheet instructions before the search's. It doesn't. I tryed to set a varaible containning my date using the spreadsheet method : SET(date, $date), it does set the data and when I use GET(date) it shows me the date. If I try TIME(GET(date)) however it'll return 0.

Any input on how I could perform my change?

TIA

-- MarcBoivin - 20 Jul 2006

Environment

TWiki version: TWiki 4.0.2 Drakar
TWiki plugins: Spreadsheet (Calc)
Server OS: FreeBSD
Web server: Apache
Perl version: 5.6.1
Client OS: Windows 2000
Web Browser: Firefox 1.5.4
Categories:  

-- MarcBoivin - 20 Jul 2006

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.

Here is the issue assuming you are doing a SEARCH: The CALC fires off too early. You need to escape it so that it runs once for each SEARCH hit. Write $percntCALC{$FORMATTIME($TIME($createdate), $year-$month-$day)}$percnt in your SEARCH format="".

-- PeterThoeny - 20 Jul 2006

 
Topic revision: r4 - 20 Jul 2006 - 18:12:11 - PeterThoeny
Support.FormattingDateInSearch moved from Support.FormmatingDateInSearch on 20 Jul 2006 - 12:46 by ArthurClemens - put it back
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback