help me in java date conversions
i dono whats happening... ihve been trying to convert date string to specific format and not getting the correct answer... i can write a fnction for the purpose but why shld i reinvent the wheel as i'm sure there will some build in funtions..
i tries classes like simpleformat,dateformat etc...
can any one help me to get out off this...
my requirement
the input date string can be in any format... mm-dd-yyyyy or dd/mm/yyyy
what ever it is i need to convert to 'yyyy-mm-dd'
[515 byte] By [
xemaa] at [2007-11-27 7:31:03]

It's not re-inventing the wheel. If you manage that, you're in for the Nobel price.
Because "any format" so far is hardly suitable for a program specification.
01-02-03 - is that Jan, 2nd, 2003 (US style) or Feb, 3rd 2001 (Euro standard)? If you can tell, you're likely to be able to tell the computer how to differ, too.
And then just fill SimpleDateFormat with the appropriate pattern.
SimpleDateFormat in = null;
SimpleDateFormat out = new SimpleDateFormat("yyyy-MM-dd");
String yourDateString = /* ... */;
String result = null;
if (yourDateString.matches("\\d{2}-\\d{2}-\\d{4}")) {
in = new SimpleDateFormat("MM-dd-yyyy");
}
else if (yourDateString.matches("\\d{4}/\\d{2}/\\d{2}")) {
in = new SimpleDateFormat("yyyy/MM/dd");
}
if (in != null) {
result = out.format(in.parse(yourDateString));
}
else {
/* format error */
}