[pmwiki-users] How to: calculate how many days left
Randy
randy at brownragfilms.com
Wed Feb 27 13:05:55 CST 2008
Thanks, Hans! I had assumed the page variable provides a number, not a
string.
I realize PmWiki may have to do it that way, but that presents a
problem: the format for the string can be a local customization. For
example, I use an international-friendly format "Wed 2008-02-27 01:23
CST". But it seems like ftime limits the formats in unspecified ways.
For example, it appears to want "at" to precede time in the string -
forcing me to be less concise. And in my limited tests I haven't yet
found a way to put year before month before date.
In doing these tests I've found that even when I use the standard
PmWiki format with varying "when" strings, only the first invocation
of ftime is actually calculated.
Here's my latest test and its results.
(:markup:)
(:linebreaks:)
[@{(ftime %s)}@] = {(ftime %s)}
standard pmwiki format = {(ftime %s when="February 27, 2008, at 05:28
AM")}
standard pmwiki format next day = {(ftime %s when="February 28, 2008,
at 05:28 AM")}
standard pmwiki format two days later = {(ftime %s when="March 1,
2008, at 05:28 AM")}
format2 = {(ftime %s when="2/27/2008 at 15:28")}
format3 = {(ftime %s when="2008-02-27 at 15:28 CST")}
format4 = {(ftime %s when="2008-02-27 at 05:28 AM")}
format5 = {(ftime %s when="2/27/2008 at 05:28 CST")}
(:markupend:)
-------Results:-------
{(ftime %s)} = 1204138129
standard pmwiki format = 1204138129
standard pmwiki format next day = 1204138129
standard pmwiki format two days later = 1204138129
format2 = 1204138129
format3 = 1204092000
format4 = 1204092000
format5 = 1204138129
Randy
On Feb 27, 2008, at 3:18 AM, Hans wrote:
>
> The problem here is that {MyPage$LastModified}
> returns a string like
> February 27, 2008, at 09:13 AM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/pmwiki-users/attachments/20080227/5d817a8c/attachment.html
More information about the pmwiki-users
mailing list