Solved

Time format JAVA

Posted on 2006-10-26
3
207 Views
Last Modified: 2012-05-05
Hi,
i have a question ...

String DATE_FORMAT = "yyyy-MM-dd hh:mm:ss";

java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(DATE_FORMAT);
Calendar c1 = Calendar.getInstance();

c1.set(Integer.parseInt(cYear), Integer.parseInt(cMonth)-1, Integer.parseInt(cDate), Integer.parseInt(cHour), Integer.parseInt(cMinute), Integer.parseInt(cSecond));
System.out.println(sdf.format(c1.getTime())));

the line with system out gives: 2006-10-05 08:00:11
but in reality it should be :  2006-10-05 20:00:11
How can i tell it to use military time?
Please help,
Thank you
0
Comment
Question by:Squadless
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
hoomanv earned 500 total points
ID: 17814869
use HH instead of hh
0
 
LVL 1

Author Comment

by:Squadless
ID: 17814896
LIFE SAVER MAN, thanks a lot...u seem to be answering lot of my questions...keep it up and when i get a raise ill buy you a house :)
0
 
LVL 14

Expert Comment

by:hoomanv
ID: 17814921
:)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now