Thanks for your guidance. Indeed, it is much more interesting to store dates with a format easy to read! Yet, I still have some difficulties. Here is the value of the variable ActionDeadline: (:ActionDeadline: 20080230T1600+0100:)
If I try to display this date with the ftime markup: * Date: {(ftime %D {$:ActionDeadline})} I get: * Date: 01/01/70 What is the problem? 2007/6/17, Patrick R. Michaud <[EMAIL PROTECTED]>:
On Sun, Jun 17, 2007 at 03:08:51PM -0400, The Editor wrote: > On 6/17/07, Patrick R. Michaud <[EMAIL PROTECTED]> wrote: > >On Sun, Jun 17, 2007 at 08:55:55AM -0400, The Editor wrote: > >> > >> I still don't like all the changes Pm made to the time function, > >> specifically to require the @ symbol, but that's how it works in > >> PmWiki. > > > >I felt this was important so that we could reliably distinguish > >ISO dates (20070617) from UNIX timestamps (@20070617). > > Perhaps the problem has > to do with the lack of documentation. Not sure where to put it though > as it's not really a ZAP function any longer. Since ZAP is providing the interface to strtotime(), I think that's probably a good place to mention the use of @ when using the results of strtotime with {(ftime)}. PmWiki itself doesn't expose timestamps to authors, but instead tries to stick with ISO formats (which have the advantage of being readable and meaningful to most authors). And, of course, {(ftime)} will accept any format that strtotime() accepts, so instead of calling strtotime in the zap form and storing the result, one could instead just store the human-readable value directly, and avoid the conversion to a timestamp altogether. Thus, instead of: > (:zapform key=AddEvent:) > (:input text EventYear:) > (:zap php_EventDate="strtotime|{EventYear}" AddEvent:) > (:zap EventDate="{php_EventDate}" AddEvent:) > (:zap savedata="EventDate" AddEvent:) > (:input submit:) > (:zapend:) > > {(ftime %Y when="{$:EventDate}":) I would think that one could more easily do something like: (:zapform key=AddEvent:) (:input text EventYear:) (:zap EventDate="{EventYear}" AddEvent:) (:zap savedata="EventDate" AddEvent:) (:input submit:) (:zapend:) {(ftime %Y when="{$:EventDate}":) In fact, it seems that one could just save EventYear directly to the page, and use it directly: {(ftime %Y when="{$:EventYear}":) Pm
_______________________________________________ pmwiki-users mailing list pmwiki-users@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-users