Reply
Sat 3 Jan, 2004 09:09 pm
I need a Formula for Quattro Pro where it automatically puts in every Sunday of a certain year.
I do not use Quattro Pro, but I can suggest a hint for calculating the day of the week as follows:
For integers y (for year), m (for month), and d (date), on the GregorianCalendar, if you calculate an integer julianDay as
julianDay=d - 32075 + 1461*(y + 4800 + (m - 14)/12)/4 + 367*(m-2 - (m-14)/12 * 12)/12 - 3*((y + 4900 + (m -14)/12)/100)/4
(This uses the integer division like in the language C. Do not arbitrarily optimize the formula.)
then the integer weeknum given as
weeknum = (julianDay + 1) % 7
((integer)%7 means the residual of the integer divided by 7)
means the number for the day of the week (0: Sunday; 1: Monday;..;6: Saturday).
.. applicable until AD 4,000.