java.util.Date.toString() is printing out wrong format
- by pacoverflow
The following code prints out "vmtDataOrig.creationdate=2012-11-03"
VmtData vmtDataOrig = VmtDataDao.getInstance().loadVmt(1);
System.out.println("vmtDataOrig.creationdate=" + vmtDataOrig.getCreationDate().toString());
Here is the definition of the creationDate field in the VmtData class:
private Date creationDate = null;
Here is the hibernate mapping of the creationDate field to the database table column:
<property name="creationDate" column="CREATIONDATE" type="date"/>
The CREATIONDATE column in the MySQL database table is of type "date", and for the record retrieved it has the value "2012-11-03".
The Javadoc for the java.util.Date.toString() method says it is supposed to print the Date object in the form "dow mon dd hh:mm:ss zzz yyyy". Anyone know why it is printing it out in the form "yyyy-MM-dd"?