SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
long t = sdf.parse("0000-00-00 00:00:00").getTime();
System.out.println(t);
Date d = new Date(t);
System.out.println(sdf.format(d));
outputs the following,
-62170185600000
0002-11-30 12:00:00
is this a bug in SimpleDateFormat or am I using it wrong to turn
a date string (eg. "2002-07-19") into a Long ?
Stephen.
Gustavo
"Stephen" <shr...@gmx.co.uk> wrote in message
news:97ae44ee.02071...@posting.google.com...
Probably more than you need to know about DateFormat objects:
http://www.javai18n.com/articles/DateFormat.html
Regards,
John O'Conner
>long t = sdf.parse("0000-00-00 00:00:00").getTime();
parse wants human-formatted dates, not 0-based ones for day and month.
--
Available for tutoring, problem solving or contract
programming for $50 US per hour or fixed price.
The Java glossary is at
http://www.mindprod.com/jgloss.html
or http://64.251.89.39/jagg.html
-
canadian mind products, roedy green
Also, there never existed a year 0. The year before 1 AD was the year 1
BC (as all who followed the discussion on when the millenium really
started knows all too well).
/Daniel