> From: =?iso-8859-1?q?Stephen=20Riek?= <stephenriek@...>
> I was playing with Jython and noticed the most bizarre behaviour
>>>>from java.text import SimpleDateFormat
>>>>sdf = SimpleDateFormat("yyyy-MM-dd hh:mm:ss")
>>>>date = sdf.parse("0000-00-00 00:00:00")
> Sun Nov 30 00:00:00 CST 0002
> Why was the date 0000-00-00 converted to 2002-11-30 ?
0000 = unspecified year = current year = 2002
01-01 = January 01
00-01 = December 01
00-00 = November 30
> Is this a flaw with the JDK java.util.Date package or jython artefact ?
Depends on your definition of flaw. :-) The micro behaviors displayed here
are useful, though counterintuitive in this case.
The answer of whether something is a Jython artifact is always, "What does
native Java code do?"
public class ZeroDate
public static void main( String args )
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd" );
System.out.println( sdf.parse( args ));
$ java ZeroDate 0000-00-00
Sun Nov 30 00:00:00 MST 0002