This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

calendar.setTime(date)  RSS feed

 
liliya woland
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, I want to get the hour of day in 24hour cycle. I know that date.getHours() is depreciated. But I'm tempted to use it since I can not get the same result out of calendar.hour call.
It seems call calendar.setTime(now) does not pick up the current date value. Anybody knows what's going on here? I have the following:

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Values such as c.HOUR do not return the hour of the date. They are constants used with the API to identify date fields.

Consider: c.get(Calendar.HOUR)
 
liliya woland
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I cant tell you how thankful I am! Thanks so much!
 
Abdul Aatif
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Values such as c.HOUR do not return the hour of the date. They are constants used with the API to identify date fields.

Consider: c.get(Calendar.HOUR)


Thank you so much.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!