Solved

Time format JAVA

Posted on 2006-10-26
3
208 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Basic Java Case or If-Else statement... 3 51
split string containing \r\n in Java 46 44
java stored proc example 9 32
mysql jsp example issue 32 38
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…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

832 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