Via {(ftime fmt="%Y")} you can get the year.
Via {(ftime fmt="%j")} you can get the day of the year.
WikiSh (set ...) and MarkupExpressionsExtensions (math ...) and
MarkupExprPlus (add/mult/etc ...) and perhaps others (?) give the capability
of simple math.  Here's how it would look in WikiSh:

Date: 2008-03-05
Apptmt: Lunch with Sam
{(set -q xnow = (ftime fmt="%Y") * 365)}
{(set -q xthen = (ftime fmt="%Y" when={$:Date}) * 365)}
{(set -q ynow = (ftime fmt="%j"))}
{(set -q ythen = (ftime fmt="%j" when={$:Date}))}
{(set -q diff = $xthen + $ythen - $xnow - $ynow)}
{(echo "Don't forget your appointment ({$:Apptmt}) in $diff days")}

Technically you should be able to do all this in a single (set ...) call but
somehow the (ftime ...) is not interacting well with (set ...) so each set
that involves (ftime ...) has to be done individually.  I'll figure that out
later, but for now this does work.  You can probably get it working with
some of the other packages (mentioned above) as well...

-Peter

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:pmwiki-users-
> [EMAIL PROTECTED] On Behalf Of imoc
> Sent: Tuesday, February 26, 2008 5:29 AM
> To: pmwiki-users@pmichaud.com
> Subject: [pmwiki-users] How to: calculate how many days left
> 
> I've been using PageList to set schedule reminders. It's as simple
> as this:
> 
> =============================
>    Date       Appointment
> -----------------------------
> 2008-03-05  Lunch with Ellen
> =============================
> 
> The 'Date' field is a PTV insert by hand. The 'Appointment' field
> is page title which I can click to edit or see the further detail.
> 
> Now I'd like to add a new field to show  how many days left from
> today to the due day. It will look like this:
> 
> =======================================
>  DaysLeft   Date       Appointment
> ---------------------------------------
>     7     2008-03-05  Lunch with Ellen
> =======================================
> 
> How to do this? Is this possible? Than for any help.
> 
> Cheers,
> imoc
> 
> 
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users@pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users


_______________________________________________
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users

Reply via email to