This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes One more GregorianCalendar question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "One more GregorianCalendar question" Watch "One more GregorianCalendar question" New topic
Author

One more GregorianCalendar question

James Brooks
Gunslinger
Ranch Hand

Joined: Aug 17, 2006
Posts: 165
My book wants me to write an app to calculate the number of days from now until the end of the year. I came up with the below, but it displays 0. If I leave the GregorianCalendar constructor blank, it initializes to the current date, right? What am I doing wrong? Thanks!

-Patrick



Hello. My name is Inigo Montoya. You killed my father. Prepare to die.
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
now.get(GregorianCalendar.DAY_OF_YEAR)
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
for more detail:

James Brooks
Gunslinger
Ranch Hand

Joined: Aug 17, 2006
Posts: 165
Thanks, guess I was missing the get().

-Patrick
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: One more GregorianCalendar question
 
Similar Threads
Number of weeks between two dates
Is it possible to generate a random date with gregorian calendar?
GregorianCalendar issues - how to display?
3 Oct 2010 only has 23 hours?
HELP needed on DATE