# On some formulas concerning calendar

Let $n$ be an integer in the range from 1 to 365, and let the $n$-th day after the end of February be the $d$-th day of the $m$-th month of a year. I know that, about twenty years ago, some formulas equivalent to the following ones have been used in a Pascal program: $$d = j\!\!\!\!\!\mod\!\!306\ \,\mathrm{div}\ 10 + 1,\ \ m = (j\ \mathrm{div}\ 306 + 2)\!\!\!\!\!\!\mod\!\!12 + 1,$$ where $j = 10\,n - 5$, and, whenever $p$ is a non-negative integer and $q$ is a positive integer, $p\!\!\!\mod\!q$ is the remainder from the division of $p$ to $q$, and $p\ \,\mathrm{div}\ q$ is the greatest integer not exceeding the quotient $p/q$. Since $$(10\,n\!-\!5)\!\!\!\!\!\mod\!\!306\ \,\mathrm{div}\ 10\ =\ (5\,n\!-\!3)\!\!\!\!\!\mod\!\!153\ \,\mathrm{div}\ 5,\ \ (10\,n\!-\!5)\ \mathrm{div}\ 306\ =\ (5\,n\!-\!3)\ \mathrm{div}\ 153$$ for all positive integers $n$, it follows from the above that also $$d = i\!\!\!\!\!\mod\!\!153\ \,\mathrm{div}\ 5 + 1,\ \ m = (i\ \mathrm{div}\ 153 + 2)\!\!\!\!\!\!\mod\!\!12 + 1$$ with $i = 5\,n - 3$. (In essential, the last expressions for $d$ and $m$ appear in the text at http://qandasys.info/need-logic-used-in-julian-days-to-gregorian-date-conversion-function-closed/, but I should like to have a bibliographic reference to some source, where expressions in the same spirit for $d$ and $m$, possibly using trunc or round and not using div, have appeared before 1994.) What about formulas of a similar kind which hold for all positive integers $n$ (in this case $d$ and $m$ can depend also on the year of the February in question)? I mean simpler ones than the formulas which could be directly obtained via going through Julian days.

-
I am curious to know why this question. Are you planning to work with number of days between two dates ? –  Claude Leibovici Jan 22 '14 at 7:58
To @ClaudeLeibovici: A reference to some source, where essentially the same formulas appeared earlier, would be useful for me for making some comments on the Pascal program I mentioned. –  Dimiter Skordev Jan 22 '14 at 9:07
Were you referring to something like Zeller's Formula or something else? See Zeller and other variants here: en.wikipedia.org/wiki/Determination_of_the_day_of_the_week –  Amzoti Jan 22 '14 at 13:14
To @Amzoti: Of course, it is in the same spirit. However, it is connected more with the Julian to Gregorian conversion in the calculation of the Easter date than to calculation of week days. Namely, one usually calculates the Easter date in the Julian calendar, and then converts it in the corresponding date in the Gregorian calendar. Let Easter be the k-th day after the end of the Julian February, l be the offset between the two calendars, and let n = k + l. If n < 366 then the Gregorian Easter date can be calculated by means of the formulas in the question I asked. –  Dimiter Skordev Jan 22 '14 at 16:55
In my previous comment, "converts it in the corresponding date" must be replaced with "converts it into the corresponding date". I am sorry for the error! –  Dimiter Skordev Jan 22 '14 at 17:50