[Remind-Fans] Calculate Time Since Calendar Date

David F. Skoll dfs at roaringpenguin.com
Wed Jul 27 15:32:14 EDT 2011


On Wed, 27 Jul 2011 12:04:12 -0700
Aric Gregson <aorchid at mac.com> wrote:

> FSET _da(da, mo, yr)            ORD(365 * (YEAR(TRIGDATE()) - yr) + \
> 					(MONNUM(TRIGDATE()) - mo) + \
>                                         DAY(TRIGDATE()) - da)

No, no, no... Remind does date calculations for you---don't try to do
them by hand!  And use Remind's built-in date types.  Don't decompose dates
into day/month/year.

What you want is something like:

    FSET _da(date) ord(trigdate() - date)
    REM 3 Aug 2011 MSG %"[_da('2011-07-04')] day since event%"

though that function is so trivial I'd just inline the whole thing.
If you have a new version of Remind, you can use $T rather than
trigdate, so it becomes simply:

    REM 3 Aug 2011 MSG %"[ord($T - '2011-07-04')] day since event%"

Regards,

David.


More information about the Remind-fans mailing list