File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Format hour and minute" Watch "Format hour and minute" New topic

Format hour and minute

Manuel Leiria
Ranch Hand

Joined: Jul 13, 2007
Posts: 171

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

Joined: Jan 10, 2002
Posts: 63536

Check out java.text.SimpleDateFormat

[Asking smart questions] [About Bear] [Books by Bear]
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 45286
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!

I agree. Here's the link:
subject: Format hour and minute
It's not a secret anymore!