Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Format

Status
Not open for further replies.

timmbo

Programmer
Feb 22, 2001
167
US
Hi all,

Have a situation with date format and not sure how to handle. I created a new date format -

SimpleDateFormat dateFormatter = new SimpleDateFormat("Kmma");
java.util.Date temp = new java.util.Date();
String time = null;
time = dateFormatter.format(temp);
custRptTitle = cstRptTitle + "(" + time + ")";


We are adding a time stamp to the end of a report title. This works fine until the code runs between the hours of noon and 1pm. The time stamp is coming up as 045pm instead of 1245pm. Anyone have any suggestions how to fix???

Any help would be most appreciated.

TIA,
Tim
 
Hi,

Try new SimpleDateFormat("hhmma");
If you look from java API documentation, the 'h' pattern is defined to be "hour in am/pm (1~12)"

-Vepo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top