This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Format hour and minute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Format hour and minute" Watch "Format hour and minute" New topic
Author

Format hour and minute

Manuel Leiria
Ranch Hand

Joined: Jul 13, 2007
Posts: 171
Hi,

I have,

which give me something like this: 3:44
but I want to get 15:44
What should I do?

thanks in advance,


Manuel Leiria<br /> <br />--------------<br />Peace cannot be kept by force; it can only be achieved by understanding. <br /> Albert Einstein
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60765
    
  65

Check out java.text.SimpleDateFormat


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37936
    
  22
Or go through the Calendar class; there is HOUR and HOUR_OF_DAY; that might help you.
Manuel Leiria
Ranch Hand

Joined: Jul 13, 2007
Posts: 171
Got it!

Thanks,
 
wood burning stoves
 
subject: Format hour and minute
 
Similar Threads
Get date/time in a timezone corresponding to local time
how to get the current date
Calendar returns wrong date?
Date Formatting Help
About protect method