[Remind-Fans] How to get reminders every 2 years?

Tim Chase remind at tim.thechases.com
Sat Sep 22 16:39:14 EDT 2018


On 2018-09-22 19:04, Claudio Pighin wrote:
> Consider that I am not an expert and that I have difficulty on
> understanding the computer language.

Ah, sorry, I didn't want to talk down to you if you already knew the
geekiness involved but should also have asked if you wanted
additional details.  The "%" is the "modulo" operator, also known as
the "remainder" when you do division.  So the expression

  $Ty % 2

means "take the trigger year ($Ty) and divide it by two and give me
the remainder".  This remainder will either be 0 (it was an even year)
or 1 (it was an odd year).  Then test for equality then expresses
which you want:  did you want the even year ("== 0") or did you want
the odd year ("== 1")

Likewise for every 4th year, you divide by 4 and get the remainder

  $Ty % 4

and then specify which offset of those 4 years you want

  $Ty % 4 == 0    # 2000, 2004, 2008, ...
  $Ty % 4 == 1    # 2001, 2005, 2009, ...
  $Ty % 4 == 2    # 2002, 2006, 2010, ...
  $Ty % 4 == 3    # 2003, 2007, 2011, ...

Hopefully that strikes the balance...helpful enough to empower you to
tweak it as needed, but not so geeky as to give you traumatic
flashbacks of middle-school math classes and doing long-division by
hand. ;-)

> verified that it works fine today 22 September 2018 and should
> also be valid in 2020, 2022, etc.

Indeed, for anything more complex than a fixed date or date-range
(that I can usually copy/paste from elsewhere in my remind files), I
always test a bunch of dates to make sure it's doing what I think it
should. 

Best wishes,

-tim






More information about the Remind-fans mailing list