- new year | months | old year | New date | old date
- ------------------------------------------------------
- 1 | 12 | 2009 | 01/01/1 | 01/01/2009
- 2 | 12 | 2009 | 01/01/2 | 27/12/2009
- 3 | 12 | 2010 | 01/01/3 | 22/12/2010
- 4 | 12 | 2011 | 01/01/4 | 17/12/2011
- 5 | 12 | 2012 | 01/01/5 | 11/12/2012
- 6 | 12 | 2013 | 01/01/6 | 06/12/2013
- 7 | 13 | 2014 | 01/01/7 | 31/12/2014
- 8 | 12 | 2015 | 01/01/8 | 26/12/2015
- 9 | 12 | 2016 | 01/01/9 | 20/12/2016
- 10 | 12 | 2017 | 01/01/10 | 15/12/2017
- 11 | 12 | 2018 | 01/01/11 | 10/12/2018
- 12 | 12 | 2019 | 01/01/12 | 05/12/2019
- 13 | 13 | 2020 | 01/01/13 | 29/12/2020
- 14 | 12 | 2021 | 01/01/14 | 24/12/2021
- 15 | 12 | 2022 | 01/01/15 | 19/12/2022
- 16 | 12 | 2023 | 01/01/16 | 14/12/2023
- 17 | 12 | 2024 | 01/01/17 | 08/12/2024
- 18 | 12 | 2025 | 01/01/18 | 03/12/2025
- 19 | 13 | 2026 | 01/01/19 | 28/12/2026
- 20 | 12 | 2027 | 01/01/20 | 23/12/2027
- 21 | 12 | 2028 | 01/01/21 | 17/12/2028
- 22 | 12 | 2029 | 01/01/22 | 12/12/2029
- 23 | 12 | 2030 | 01/01/23 | 07/12/2030
- 24 | 12 | 2031 | 01/01/24 | 02/12/2031
- 25 | 13 | 2032 | 01/01/25 | 26/12/2032
- 26 | 12 | 2033 | 01/01/26 | 21/12/2033
- 27 | 12 | 2034 | 01/01/27 | 16/12/2034
- 28 | 12 | 2035 | 01/01/28 | 11/12/2035
- 29 | 12 | 2036 | 01/01/29 | 05/12/2036
- 30 | 13 | 2037 | 01/01/30 | 30/12/2037
- 31 | 12 | 2038 | 01/01/31 | 25/12/2038
- 32 | 12 | 2039 | 01/01/32 | 20/12/2039
- 33 | 12 | 2040 | 01/01/33 | 14/12/2040
- 34 | 12 | 2041 | 01/01/34 | 09/12/2041
- 35 | 12 | 2042 | 01/01/35 | 04/12/2042
- 36 | 13 | 2043 | 01/01/36 | 29/12/2043
- 37 | 12 | 2044 | 01/01/37 | 23/12/2044
- 38 | 12 | 2045 | 01/01/38 | 18/12/2045
- 39 | 12 | 2046 | 01/01/39 | 13/12/2046
- 40 | 12 | 2047 | 01/01/40 | 08/12/2047
- 41 | 12 | 2048 | 01/01/41 | 02/12/2048
- 42 | 13 | 2049 | 01/01/42 | 27/12/2049
- 43 | 12 | 2050 | 01/01/43 | 22/12/2050
- 44 | 12 | 2051 | 01/01/44 | 17/12/2051
- 45 | 12 | 2052 | 01/01/45 | 11/12/2052
- 46 | 12 | 2053 | 01/01/46 | 06/12/2053
- 47 | 13 | 2054 | 01/01/47 | 31/12/2054
- 48 | 12 | 2055 | 01/01/48 | 26/12/2055
- 49 | 12 | 2056 | 01/01/49 | 20/12/2056
- 50 | 12 | 2057 | 01/01/50 | 15/12/2057
- 51 | 12 | 2058 | 01/01/51 | 10/12/2058
- 52 | 12 | 2059 | 01/01/52 | 05/12/2059
- 53 | 13 | 2060 | 01/01/53 | 29/12/2060
- 54 | 12 | 2061 | 01/01/54 | 24/12/2061
- 55 | 12 | 2062 | 01/01/55 | 19/12/2062
- 56 | 12 | 2063 | 01/01/56 | 14/12/2063
- 57 | 12 | 2064 | 01/01/57 | 08/12/2064
- 58 | 12 | 2065 | 01/01/58 | 03/12/2065
- 59 | 13 | 2066 | 01/01/59 | 28/12/2066
- 60 | 12 | 2067 | 01/01/60 | 23/12/2067
- 61 | 12 | 2068 | 01/01/61 | 17/12/2068
- 62 | 12 | 2069 | 01/01/62 | 12/12/2069
- 63 | 12 | 2070 | 01/01/63 | 07/12/2070
- 64 | 12 | 2071 | 01/01/64 | 02/12/2071
- 65 | 13 | 2072 | 01/01/65 | 26/12/2072
- 66 | 12 | 2073 | 01/01/66 | 21/12/2073
- 67 | 12 | 2074 | 01/01/67 | 16/12/2074
- 68 | 12 | 2075 | 01/01/68 | 11/12/2075
- 69 | 12 | 2076 | 01/01/69 | 05/12/2076
- 70 | 13 | 2077 | 01/01/70 | 30/12/2077
- 71 | 12 | 2078 | 01/01/71 | 25/12/2078
- 72 | 12 | 2079 | 01/01/72 | 20/12/2079
- 73 | 12 | 2080 | 01/01/73 | 14/12/2080
- 74 | 12 | 2081 | 01/01/74 | 09/12/2081
- 75 | 12 | 2082 | 01/01/75 | 04/12/2082
- 76 | 13 | 2083 | 01/01/76 | 29/12/2083
- 77 | 12 | 2084 | 01/01/77 | 23/12/2084
- 78 | 12 | 2085 | 01/01/78 | 18/12/2085
- 79 | 12 | 2086 | 01/01/79 | 13/12/2086
- 80 | 12 | 2087 | 01/01/80 | 08/12/2087
- 81 | 12 | 2088 | 01/01/81 | 02/12/2088
- 82 | 13 | 2089 | 01/01/82 | 27/12/2089
- 83 | 12 | 2090 | 01/01/83 | 22/12/2090
- 84 | 12 | 2091 | 01/01/84 | 17/12/2091
- 85 | 12 | 2092 | 01/01/85 | 11/12/2092
- 86 | 12 | 2093 | 01/01/86 | 06/12/2093
- 87 | 13 | 2094 | 01/01/87 | 31/12/2094
- 88 | 12 | 2095 | 01/01/88 | 26/12/2095
- 89 | 12 | 2096 | 01/01/89 | 20/12/2096
- 90 | 12 | 2097 | 01/01/90 | 15/12/2097
- 91 | 12 | 2098 | 01/01/91 | 10/12/2098
- 92 | 12 | 2099 | 01/01/92 | 05/12/2099
- 93 | 13 | 2100 | 01/01/93 | 30/12/2100
- 94 | 12 | 2101 | 01/01/94 | 25/12/2101
- 95 | 12 | 2102 | 01/01/95 | 20/12/2102
- 96 | 12 | 2103 | 01/01/96 | 15/12/2103
- 97 | 12 | 2104 | 01/01/97 | 09/12/2104
- 98 | 12 | 2105 | 01/01/98 | 04/12/2105
- 99 | 13 | 2106 | 01/01/99 | 29/12/2106
- 100 | 12 | 2107 | 01/01/100 | 24/12/2107
- 101 | 12 | 2108 | 01/01/101 | 18/12/2108
Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.
Forum Search
Forum Statistics
UsersTotal Post History
- Posts:
- 78223
- Topics:
- 17805
7-Day Post History
- New Posts:
- 37
- New Topics:
- 12
- Active Topics:
- 14
Our newest member
Other
-
FAQ
All times are UTC [ DST ]
Google Ads
LTD Puzzle 20: A simpler calendar
Forum rules
Always post answers in a "Hidecode" tag, so that others have a chance to answer the question too.
Always post answers in a "Hidecode" tag, so that others have a chance to answer the question too.
13 posts • Page 1 of 1
Please wait...
LTD Puzzle 20: A simpler calendar
Making a simple calendar, I find that all these months with a different number of days is confussing. So I would like to have a calendar with 30 days per month from now on and 12 months a year. The only problem is that It will no longer be going with the sun. The sun being a 365 day/year cycle the new calendar has 360 days/year. So I need to compensate but only by adding a 13 month at certain years. Write me a program that calculates when to add a month to keep in synch more or less.
You can start at the 1st of january 2009.
Desired output.
Above data could be wrong
Don't forget the leap years.
You can start at the 1st of january 2009.
Desired output.
| new calendar year | number of months | old calendar year | new calendar date | old calendar date (dd/mm/yyyy) |
|---|---|---|---|---|
| 1 | 12 | 2009 | 1/1/1 | 1/1/2009 |
| 2 | 12 | 2009 | 1/1/2 | 26/12/2009 |
| 3 | 12 | 2010 | 1/1/3 | 20/12/2010 |
Above data could be wrong

Don't forget the leap years.
pink fuzzy slippers
-

chrissie1 - Senior Guru

-











- Posts: 9080
- Joined: Wed Oct 10, 2007 7:18 pm
- Location: Belgium
Re: LTD Puzzle 20: A simpler calendar
is this correct?
2009-01-01 00:00:00.000 2009-12-27 00:00:00.000
2009-12-27 00:00:00.000 2010-12-22 00:00:00.000
2010-12-22 00:00:00.000 2011-12-17 00:00:00.000
2011-12-17 00:00:00.000 2013-01-10 00:00:00.000
2013-01-10 00:00:00.000 2014-01-05 00:00:00.000
2014-01-05 00:00:00.000 2014-12-31 00:00:00.000
2014-12-31 00:00:00.000 2016-01-25 00:00:00.000
2015-12-26 00:00:00.000 2017-01-19 00:00:00.000
2017-01-19 00:00:00.000 2018-01-14 00:00:00.000
2018-01-14 00:00:00.000 2019-02-08 00:00:00.000
2019-01-09 00:00:00.000 2020-02-03 00:00:00.000
2020-01-04 00:00:00.000 2021-01-28 00:00:00.000
2021-01-28 00:00:00.000 2022-02-22 00:00:00.000
2022-01-23 00:00:00.000 2023-02-17 00:00:00.000
2023-01-18 00:00:00.000 2024-02-12 00:00:00.000
2024-01-13 00:00:00.000 2025-03-08 00:00:00.000
2025-02-06 00:00:00.000 2026-03-03 00:00:00.000
2026-02-01 00:00:00.000 2027-02-26 00:00:00.000
2027-01-27 00:00:00.000 2028-03-22 00:00:00.000
2028-01-22 00:00:00.000 2029-03-17 00:00:00.000
2029-02-15 00:00:00.000 2030-03-12 00:00:00.000
2009-01-01 00:00:00.000 2009-12-27 00:00:00.000
2009-12-27 00:00:00.000 2010-12-22 00:00:00.000
2010-12-22 00:00:00.000 2011-12-17 00:00:00.000
2011-12-17 00:00:00.000 2013-01-10 00:00:00.000
2013-01-10 00:00:00.000 2014-01-05 00:00:00.000
2014-01-05 00:00:00.000 2014-12-31 00:00:00.000
2014-12-31 00:00:00.000 2016-01-25 00:00:00.000
2015-12-26 00:00:00.000 2017-01-19 00:00:00.000
2017-01-19 00:00:00.000 2018-01-14 00:00:00.000
2018-01-14 00:00:00.000 2019-02-08 00:00:00.000
2019-01-09 00:00:00.000 2020-02-03 00:00:00.000
2020-01-04 00:00:00.000 2021-01-28 00:00:00.000
2021-01-28 00:00:00.000 2022-02-22 00:00:00.000
2022-01-23 00:00:00.000 2023-02-17 00:00:00.000
2023-01-18 00:00:00.000 2024-02-12 00:00:00.000
2024-01-13 00:00:00.000 2025-03-08 00:00:00.000
2025-02-06 00:00:00.000 2026-03-03 00:00:00.000
2026-02-01 00:00:00.000 2027-02-26 00:00:00.000
2027-01-27 00:00:00.000 2028-03-22 00:00:00.000
2028-01-22 00:00:00.000 2029-03-17 00:00:00.000
2029-02-15 00:00:00.000 2030-03-12 00:00:00.000
-

SQLDenis - LTD Admin

-












- Posts: 21149
- Joined: Wed Oct 10, 2007 6:43 pm
- Location: Princeton, New Jersey, USA,World, Solar System, Milky Way, Universe and Beyond
Re: LTD Puzzle 20: A simpler calendar
BTW here is the code in T-SQL for the next 200 years
I still have a slight problem, will fix it tomorrow since I have to run now
Code is hidden, SHOW
I still have a slight problem, will fix it tomorrow since I have to run now
-

SQLDenis - LTD Admin

-












- Posts: 21149
- Joined: Wed Oct 10, 2007 6:43 pm
- Location: Princeton, New Jersey, USA,World, Solar System, Milky Way, Universe and Beyond
Re: LTD Puzzle 20: A simpler calendar
pink fuzzy slippers
-

chrissie1 - Senior Guru

-











- Posts: 9080
- Joined: Wed Oct 10, 2007 7:18 pm
- Location: Belgium
Re: LTD Puzzle 20: A simpler calendar
My results don't like right after I add the 13th month 

-

SQLDenis - LTD Admin

-












- Posts: 21149
- Joined: Wed Oct 10, 2007 6:43 pm
- Location: Princeton, New Jersey, USA,World, Solar System, Milky Way, Universe and Beyond
Re: LTD Puzzle 20: A simpler calendar
Chrissie1,
I think there is a minor flaw with your output. To accommodate the 5 missing days each year, we need to occasionally add a 13th month. Since each month is supposed to have exactly 30 days, this means we need to add an extra month every 6 years. You appear to be doing this, but.... shouldn't the first year with 13 months be year 6. In your output, the first year you have with 13 months is year 7. After that, every 6th year has 13 months, as I would expect.
My submission:
Output:
I think there is a minor flaw with your output. To accommodate the 5 missing days each year, we need to occasionally add a 13th month. Since each month is supposed to have exactly 30 days, this means we need to add an extra month every 6 years. You appear to be doing this, but.... shouldn't the first year with 13 months be year 6. In your output, the first year you have with 13 months is year 7. After that, every 6th year has 13 months, as I would expect.
My submission:
Code is hidden, SHOW
Output:
Code is hidden, SHOW
-George
-

gmmastros - LTD Admin

-











- Posts: 2215
- Joined: Tue Oct 09, 2007 5:19 pm
Re: LTD Puzzle 20: A simpler calendar
I'm pretty sure it's not every six years since that doesn't account for leap years. It is whenever you have more than 30 days left in a year then you add an extra month.
As you can see your solution is degarading over time. in the end you already have your old year somewhrer in octobre while mine always stays in december.
SO mine is more rigth than yours.
As you can see your solution is degarading over time. in the end you already have your old year somewhrer in octobre while mine always stays in december.
SO mine is more rigth than yours.
pink fuzzy slippers
-

chrissie1 - Senior Guru

-











- Posts: 9080
- Joined: Wed Oct 10, 2007 7:18 pm
- Location: Belgium
Re: LTD Puzzle 20: A simpler calendar
- earthandfire
- Senior Apprentice

-

- Posts: 97
- Joined: Sun Nov 25, 2007 6:07 pm
Re: LTD Puzzle 20: A simpler calendar
I agree with both points of view. I think the point was that the new calendar should keep in sink more or less with the older calendar so when you add the extra month is open to some debate. But I guess your interpretation would cause even less degradation of the seasons.
Georges solution was a bit flawed because it was degrading to a point where the simple calendars newyear would be in octobre. Mine always fell in december. And E&F is either in january or december.
But am I the only one that is using a sensible programming language?
Georges solution was a bit flawed because it was degrading to a point where the simple calendars newyear would be in octobre. Mine always fell in december. And E&F is either in january or december.
But am I the only one that is using a sensible programming language?
pink fuzzy slippers
-

chrissie1 - Senior Guru

-











- Posts: 9080
- Joined: Wed Oct 10, 2007 7:18 pm
- Location: Belgium
Re: LTD Puzzle 20: A simpler calendar
- earthandfire
- Senior Apprentice

-

- Posts: 97
- Joined: Sun Nov 25, 2007 6:07 pm
-

chrissie1 - Senior Guru

-











- Posts: 9080
- Joined: Wed Oct 10, 2007 7:18 pm
- Location: Belgium
Re: LTD Puzzle 20: A simpler calendar
I take that from you, Chrissie, as a compliment - thank you!
- earthandfire
- Senior Apprentice

-

- Posts: 97
- Joined: Sun Nov 25, 2007 6:07 pm
Re: LTD Puzzle 20: A simpler calendar
earthandfire wrote:I take that from you, Chrissie, as a compliment - thank you!
I aim to please.
pink fuzzy slippers
-

chrissie1 - Senior Guru

-











- Posts: 9080
- Joined: Wed Oct 10, 2007 7:18 pm
- Location: Belgium
13 posts • Page 1 of 1


LTD Social Sitings
Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.