[pmwiki-users] How to: calculate how many days left

imoc blog.oc at gmail.com
Wed Feb 27 04:41:34 CST 2008

Sorry for delaying to this thread. Being busy.

I'm a little confused about the solution, so, may I reorganize it as follow 
and please correct me if I write something wrong:

1) Installing http://www.pmwiki.org/wiki/Cookbook/MarkupExprPlus recipe

2) Adding some codes in config.php

# unix time, seconds since 1970-01-01
$MarkupExpr['utime'] = 'MxUTime($args[0])';
function MxUTime($arg) {
        $udate = date('U', strtotime($arg));
        if ($arg=='now') $udate = time();
        return $udate;


# unix time, days since 1970-01-01
$MarkupExpr['udays'] = 'MxUDays($args[0])';
function MxUDays($arg) {
        $udate = date('U', strtotime($arg));
        if ($arg=='now') $udate = time();
        return floor($udate/86400);


3) Using " {(sub (udays {$:Date}) (udays now) )} " in wiki pages to 
   get number of how many days left.

Is this right? Thank all of you.


More information about the pmwiki-users mailing list