• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

calendar.setTime(date)

 
liliya woland
Ranch Hand
Posts: 134
  • 0
  • 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
Pie
Posts: 64173
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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
  • 0
  • 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
  • 0
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic