Login or Sign Up to become a member!
LessThanDot Site Logo

LessThanDot

A Technical Community for IT Professionals

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.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot facebook Lessthandot rss

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

Highly Rated Users

Forum
No Posts Rated

Top 50
Given
Received

Forum Statistics

Users
Members:
1537
Members Online:
4
Guests Online:
17

Total Post History
Posts:
80274
Topics:
18352

7-Day Post History
New Posts:
7
New Topics:
2
Active Topics:
4

Our newest member
Alpha

Other

FAQ
All times are UTC [ DST ]

Google Ads

LTD Puzzle 20: A simpler calendar

Mind Boggling Puzzles, to keep that grey matter in shape...
Forum rules
Always post answers in a "Hidecode" tag, so that others have a chance to answer the question too.
Please wait...

LTD Puzzle 20: A simpler calendar

Postby chrissie1 on Fri Jan 30, 2009 9:54 am

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.

new calendar yearnumber of monthsold calendar yearnew calendar dateold calendar date (dd/mm/yyyy)
11220091/1/11/1/2009
21220091/1/226/12/2009
31220101/1/320/12/2010


Above data could be wrong ;-)

Don't forget the leap years.
pink fuzzy slippers
User avatar
chrissie1
Senior Guru
Senior Guru
LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088
LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088
LTD Gold - Rating: 2088LTD Gold - Rating: 2088
 
Posts: 9340
Joined: Wed Oct 10, 2007 7:18 pm
Location: Belgium
Unrated

Re: LTD Puzzle 20: A simpler calendar

Postby SQLDenis on Fri Jan 30, 2009 8:47 pm

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
User avatar
SQLDenis
LTD Admin
LTD Admin
LTD Gold - Rating: 3451LTD Gold - Rating: 3451LTD Gold - Rating: 3451LTD Gold - Rating: 3451LTD Gold - Rating: 3451
LTD Gold - Rating: 3451LTD Gold - Rating: 3451LTD Gold - Rating: 3451LTD Gold - Rating: 3451LTD Gold - Rating: 3451
LTD Gold - Rating: 3451LTD Gold - Rating: 3451LTD Gold - Rating: 3451
 
Posts: 21667
Joined: Wed Oct 10, 2007 6:43 pm
Location: Princeton, New Jersey, USA,World, Solar System, Milky Way, Universe and Beyond
Unrated

Re: LTD Puzzle 20: A simpler calendar

Postby SQLDenis on Fri Jan 30, 2009 9:43 pm

BTW here is the code in T-SQL for the next 200 years

Code is hidden, SHOW



I still have a slight problem, will fix it tomorrow since I have to run now
User avatar
SQLDenis
LTD Admin
LTD Admin
LTD Gold - Rating: 3451LTD Gold - Rating: 3451LTD Gold - Rating: 3451LTD Gold - Rating: 3451LTD Gold - Rating: 3451
LTD Gold - Rating: 3451LTD Gold - Rating: 3451LTD Gold - Rating: 3451LTD Gold - Rating: 3451LTD Gold - Rating: 3451
LTD Gold - Rating: 3451LTD Gold - Rating: 3451LTD Gold - Rating: 3451
 
Posts: 21667
Joined: Wed Oct 10, 2007 6:43 pm
Location: Princeton, New Jersey, USA,World, Solar System, Milky Way, Universe and Beyond
Unrated

Re: LTD Puzzle 20: A simpler calendar

Postby chrissie1 on Fri Jan 30, 2009 9:52 pm

My solution and results

Code is hidden, SHOW


Code is hidden, SHOW
pink fuzzy slippers
User avatar
chrissie1
Senior Guru
Senior Guru
LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088
LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088
LTD Gold - Rating: 2088LTD Gold - Rating: 2088
 
Posts: 9340
Joined: Wed Oct 10, 2007 7:18 pm
Location: Belgium
Unrated

Re: LTD Puzzle 20: A simpler calendar

Postby SQLDenis on Fri Jan 30, 2009 9:55 pm

My results don't like right after I add the 13th month :-(
User avatar
SQLDenis
LTD Admin
LTD Admin
LTD Gold - Rating: 3451LTD Gold - Rating: 3451LTD Gold - Rating: 3451LTD Gold - Rating: 3451LTD Gold - Rating: 3451
LTD Gold - Rating: 3451LTD Gold - Rating: 3451LTD Gold - Rating: 3451LTD Gold - Rating: 3451LTD Gold - Rating: 3451
LTD Gold - Rating: 3451LTD Gold - Rating: 3451LTD Gold - Rating: 3451
 
Posts: 21667
Joined: Wed Oct 10, 2007 6:43 pm
Location: Princeton, New Jersey, USA,World, Solar System, Milky Way, Universe and Beyond
Unrated

Re: LTD Puzzle 20: A simpler calendar

Postby gmmastros on Sat Jan 31, 2009 3:47 pm

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:

Code is hidden, SHOW


Output:

Code is hidden, SHOW
-George
User avatar
gmmastros
LTD Admin
LTD Admin
LTD Gold - Rating: 1616LTD Gold - Rating: 1616LTD Gold - Rating: 1616LTD Gold - Rating: 1616LTD Gold - Rating: 1616
LTD Gold - Rating: 1616LTD Gold - Rating: 1616LTD Gold - Rating: 1616LTD Gold - Rating: 1616LTD Gold - Rating: 1616
LTD Gold - Rating: 1616LTD Gold - Rating: 1616
 
Posts: 2315
Joined: Tue Oct 09, 2007 5:19 pm
Unrated

Re: LTD Puzzle 20: A simpler calendar

Postby chrissie1 on Sat Jan 31, 2009 6:04 pm

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.
pink fuzzy slippers
User avatar
chrissie1
Senior Guru
Senior Guru
LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088
LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088
LTD Gold - Rating: 2088LTD Gold - Rating: 2088
 
Posts: 9340
Joined: Wed Oct 10, 2007 7:18 pm
Location: Belgium
Unrated

Re: LTD Puzzle 20: A simpler calendar

Postby earthandfire on Sun Feb 01, 2009 6:54 am

I agree with George with regard to which years should contain the extra month - the earliest years which can support 390 days should have 390 days.

The following also supports leap years.

Code is hidden, SHOW


Code is hidden, SHOW
earthandfire
Senior Apprentice
Senior Apprentice
LTD Bronze - Rating: 63LTD Bronze - Rating: 63
 
Posts: 103
Joined: Sun Nov 25, 2007 6:07 pm

Re: LTD Puzzle 20: A simpler calendar

Postby chrissie1 on Sun Feb 01, 2009 9:50 am

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?
pink fuzzy slippers
User avatar
chrissie1
Senior Guru
Senior Guru
LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088
LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088
LTD Gold - Rating: 2088LTD Gold - Rating: 2088
 
Posts: 9340
Joined: Wed Oct 10, 2007 7:18 pm
Location: Belgium
Unrated

Re: LTD Puzzle 20: A simpler calendar

Postby earthandfire on Sun Feb 01, 2009 12:07 pm

A VB Solution just for Chrissie

Code is hidden, SHOW


Code is hidden, SHOW
earthandfire
Senior Apprentice
Senior Apprentice
LTD Bronze - Rating: 63LTD Bronze - Rating: 63
 
Posts: 103
Joined: Sun Nov 25, 2007 6:07 pm
Unrated

Re: LTD Puzzle 20: A simpler calendar

Postby chrissie1 on Sun Feb 01, 2009 12:14 pm

Not bad.
pink fuzzy slippers
User avatar
chrissie1
Senior Guru
Senior Guru
LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088
LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088
LTD Gold - Rating: 2088LTD Gold - Rating: 2088
 
Posts: 9340
Joined: Wed Oct 10, 2007 7:18 pm
Location: Belgium
Unrated

Re: LTD Puzzle 20: A simpler calendar

Postby earthandfire on Sun Feb 01, 2009 1:05 pm

I take that from you, Chrissie, as a compliment - thank you!
earthandfire
Senior Apprentice
Senior Apprentice
LTD Bronze - Rating: 63LTD Bronze - Rating: 63
 
Posts: 103
Joined: Sun Nov 25, 2007 6:07 pm
Unrated

Re: LTD Puzzle 20: A simpler calendar

Postby chrissie1 on Sun Feb 01, 2009 2:33 pm

earthandfire wrote:I take that from you, Chrissie, as a compliment - thank you!


I aim to please.
pink fuzzy slippers
User avatar
chrissie1
Senior Guru
Senior Guru
LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088
LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088LTD Gold - Rating: 2088
LTD Gold - Rating: 2088LTD Gold - Rating: 2088
 
Posts: 9340
Joined: Wed Oct 10, 2007 7:18 pm
Location: Belgium
Unrated