• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calendar weirdness...

 
Vinnie Jenks
Ranch Hand
Posts: 207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to develop a simple method that prints the day, month, day number, and year from the current day forward for 4 months.

For example, from today forward it would start like this:



I've got it working but something strange happens when it rolls past the current year....the loop becomes infinite and it doesn't stop after 4 months! If it doesn't go beyond the current year...it only shows 4 months worth of lines!

Here's my code:



Why does it not stop after 4 months if it rolls past Dec of the current year? I know I must be missing something obvious but I'm getting fatigued w/ it...hopefully someone can explain?

Thanks!
 
fred Joly
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You said "month" is an int.
So imagine you start in month = 10.
I guess Calendar.MONTH is always smaller than 14....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic