Thank very much Tim for the good lesson!!!
Il Sab 22 Set 2018, 22:39 Tim Chase <[email protected]> ha scritto: > 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 > > > > >
_______________________________________________ Remind-fans mailing list [email protected] http://lists.roaringpenguin.com/cgi-bin/mailman/listinfo/remind-fans Remind is at http://www.roaringpenguin.com/products/remind
