@Echo Off :: Quickly hacked together (9-Feb-2001) from my WordPerfect Calendar macro :: Michael Bednarek, mb@tgm.com.au, www.geocities.com\mcmbednarek\ :: May occasionally be off by one day :-( :: June 2005: The behaviour of the "\" (integer division) operand under :: 4NT is different from 4DOS. This release accounts for that. It also :: uses a more elegant method to compute the last day of the month. SetLocal UnAlias * :: Parameters are NOT checked Set Month=%1 If "%Month" == "" Set Month=%_Month Set Year=%2 If "%Year" == "" Set Year=%_Year Set TotalDays=%@Eval[%@Date[1/%Month/%Year] - 1] Set SynodMonth=%@Eval[29 + 12 / 24 + 44 / 1440 + 2.8 / 86400] %+:: or there abouts :: Find last day of this month SET Days=%@EVAL[42 - %@DAY[%@MAKEDATE[%@EVAL[%@DATE[%Year/%Month/1] + 41],4]]] :: Find New Moon(s) [could probably be combined with the loop for Full Moon(s)] Set NewMoon=0 Set cnt=%@Eval[%TotalDays - 16] Set cnt2=0 Set NewCnt=0 Do Forever Set NewMoon=%@Int[%@Eval[%SynodMonth - (%cnt - %@INT[%@EVAL[%cnt / %SynodMonth + %cnt2]] * %SynodMonth)]] If %NewMoon LT 1 Goto /I nn If %NewMoon GT %Days Leave Set NewCnt=%@Eval[%NewCnt + 1] Set aNew%NewCnt=%newMoon :nn Set cnt2=%@Eval[%cnt2 + 1] EndDo :: Find Full Moon(s) Set FullMoon=0 Set FullCnt=0 Set cnt=%@Eval[%cnt - %SynodMonth / 2] Set cnt2=0 Do Forever Set FullMoon=%@Int[%@Eval[%SynodMonth - (%cnt - %@INT[%@EVAL[%cnt / %SynodMonth + %cnt2]] * %SynodMonth)]] If %FullMoon LT 1 Goto /I nf If %FullMoon GT %Days Leave Set FullCnt=%@Eval[%FullCnt + 1] Set aFull%FullCnt=%fullMoon :nf Set cnt2=%@Eval[%cnt2 + 1] EndDo Do cnt = 1 To %NewCnt Echo New Moon on = %[aNew%cnt] %Month %Year EndDo Do cnt = 1 To %FullCnt Echo Full Moon on = %[aFull%cnt] %Month %Year EndDo