0

large to small could go 2021-Jan-02nd.

Suppose want it in U.S. style, 01/02/'21, where 01/01 = January 1st = day#1 of the year (2021).

01|31

02|28,29

03|31

04|30

05|31

06|30

07|31

08|31

09|30

10|31

11|30

12|31

02 # days, February has 28 on non leap-years; starting starting from 2000: {'01,'02,'03}+4y. 29 on leap day, every fourth year; starting from 2000: {'00}+4y

good so far? How to proceed? Any elegant formula?

J. W. Tanner
  • 63,683
  • 4
  • 43
  • 88
  • What are you looking for, exactly? – Raffaele Jan 02 '21 at 22:39
  • @Raffaele: A function I guess of the form D(y,#)=mm/dd/'yy, where D=full six-digit date, y=year, and #=number day out of that year. The latter two of the output in that case would be somewhat redundant since the year is already given, so it could be dropped. I would like also to include day of week if that is implementable upon the existing inputs. So then it becomes D(y,#)=day,Month-date. Also it would be nice to go in reverse, i.e. (mm/dd/'yy --> #). –  Jan 02 '21 at 23:09
  • Honestly, this is computer science and not math. If you ask in Stack Overflow, they’d tell you to construct a look-up table. Or better, use a package that someone has already written. – Benjamin Wang Jan 02 '21 at 23:18
  • 1
    @J. W. Tanner: Thankye for adding the "calendar computation" tags! I didn't know that was a category already, should have checked. –  Jan 03 '21 at 00:23
  • Are you looking for something like this?https://math.stackexchange.com/questions/3894758/what-is-derivation-of-this-formula-to-find-the-day-of-any-date-in-gregorian-cale – Wolgwang Jan 03 '21 at 01:19
  • @YouKnowMe pretty similar, but in this case am seeking not just the day of week but also the mm-dd given the # calendar_day out of 365 or 366 and yyyy, as well as the other way around. Alternatively, how many days till end of the year (or a certain index, e.g. the following May 19th) could be useful. –  Jan 03 '21 at 01:24
  • 1
    There is a leap year every time the year is divisible by $4$, except when the year is divisible by $100$, except when the year is divisible by $400$. Than means, for example, $1896$ had was a leap year, $1900$ was not a leap year, but $2000$ was leap year. – poetasis Jan 03 '21 at 03:04

0 Answers0