Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Java in General and the fly likes Problem with the date 2005-07-14 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Problem with the date 2005-07-14" Watch "Problem with the date 2005-07-14" New topic

Problem with the date 2005-07-14

Abigail Moore

Joined: May 13, 2004
Posts: 12
Hi I am having a problem with a date being passed as 2005-07-14 from a String Array of selected dates.

Here is my code:

private String getMaximum(String[] array)
int maximum = 0;

if (logger.isInfoEnabled())
{"WizardReportForm getMaximum()");
if (array != null)

for (int index = 0; index < array.length; index++)

int value = Integer.parseInt(array[index]);
if (value > maximum)
maximum = value;



String str = Integer.toString(maximum);

return str;
return null;


How do I take that date and remove the dashes- but keep the orginal in the array list, and pass the date without the dashes on to the db.

Help Lost again!
marc weber

Joined: Aug 31, 2004
Posts: 11343

I'm not really following your process, but if all you need to do is create a new String that's like the old String except that it has the dashes removed (keeping the old String intact), try this...

[ August 02, 2005: Message edited by: marc weber ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
Abigail Moore

Joined: May 13, 2004
Posts: 12
Thank you. That helped a lot!
Ravi Srinivas

Joined: Sep 04, 2003
Posts: 26
Ahh.. the 14th of July, what a troublesome date!
I agree. Here's the link:
subject: Problem with the date 2005-07-14
jQuery in Action, 3rd edition