[pmwiki-users] How to: calculate how many days left
Hans
design5 at softflow.co.uk
Wed Feb 27 03:18:59 CST 2008
Wednesday, February 27, 2008, 2:07:22 AM, Randy wrote:
> Actually, the utime function does not correctly return the number of
> seconds from the unix epoch.
It does. In fact it reports the same results as {(ftime %s DATE)},
both are equivalent.
> At 7:30 p.m. I tried this:
> {(sub (utime now) (utime {MyPage$LastModified}) )}
> It evaluated to over 20 hours, even though I had modified MyPage
> within the previous minute or two.
> I suspect utime loses precision when it calls the date function.
The problem here is that {MyPage$LastModified}
returns a string like
February 27, 2008, at 09:13 AM
and utime or ftime disregard the latter part.
You need to enclose it in hyphens in order to get correct results,
so the expression can recognise it as one argument:
{(sub (utime now) (utime '{MyPage$LastModified}' ))}
~Hans
More information about the pmwiki-users
mailing list