[dev-context] [NTG-context] Week number

Taco Hoekwater taco at elvenkind.com
Sun Dec 31 10:03:14 CET 2006


Hi,

(switched mailing lists)

Hans Hagen wrote:
>>
>>I do not know if someone will find it useful or not, but it seems like 
>>a nice feature to have :)

I'll look into wrapping it up a bit first. This code is written
very much for comp.text.tex posting: \modulonumber is already
present in ConTeXt, my macro names are optimized for shortness,
and there is a slower but better definition of the integer divide
possible (without multiplication):

   \def\divisionnumber#1#2%
      {\Expr{(#2/#1)-((\modulonumber{#1}{#2})/#1)}}


> see core-con.tex, such things have been there for years now  -) 

> (not sure if it does the same as what taco code does) 

My macro does something that wasn't there yet: it calculates a
'week number' based on the current date: \weeknumber{31}{12}{2006}
expands to 52 (and my macro is fully expandable).

The internal macro \Jday calculates the current julian day, and
that can help make \getdayoftheweek much shorter:

   \def\getdayoftheweek#1#2#3%
      {\normalweeday\Expr{\Mod{\Jday{#1}{#2}{#3}+1}{7}+1}}%


Best, Taco




More information about the dev-context mailing list