Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 372
  • Last Modified:

Time reading in 24hr notation and 12hr notation

I don't know whether it's a silly question or what but just want to know.

Could you please give me a sample program that reads time in 24 hour notation and 12 hours notation.

e.g Output ( 15:30:25)
           (  3:30:25 pm)
0
sourceother
Asked:
sourceother
1 Solution
 
schybertCommented:
import java.text.SimpleDateFormat;
import java.util.Date;

...
String date24 = new SimpleDateFormat("HH:mm:ss").format(new Date());

String date12 = new SimpleDateFormat("hh:mm:ss a").format(new Date());

...

The 'a' on the second format is the am/pm marker.
0
 
CleanupPingCommented:
sourceother:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
jimmackCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept schybert's comment as answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jimmack
EE Cleanup Volunteer
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now