java - Oracle to Hibernate to ISO 8601 Date format -


i have entity field declared date , mapped date field in oracle. when print value field, date format 2013-04-23 09:05:03.0.

i need convert date iso 8601 format. used:

system.out.println("converted date:" + asxmlgregoriancalendar(retruneddate);  private static datatypefactory df = datatypefactory.newinstance();  public static xmlgregoriancalendar asxmlgregoriancalendar(java.util.date date) {     if (date == null) {         return null;     } else {         datatypefactory df = datatypefactory.newinstance();         gregoriancalendar gc = new gregoriancalendar();         gc.settimeinmillis(date.gettime());         return df.newxmlgregoriancalendar(gc);     } } 

the following code returns:

system.out.println("converted date:" + asxmlgregoriancalendar(retruneddate);  // output converted date: 2013-04-23t09:05:03.000-05:00 

questions:

  1. there 000 instead of actual number. not sure why?
  2. what 0 @ end hibernate 2013-04-23 09:05:03.0? how full date?

when pass date, result need.:

system.out.println("converted date:" + asxmlgregoriancalendar(new date());  // output converted date: 2013-08-23t17:19:15.664-05:00 

this need. instead of 000, need milliseconds. hibernate doing date?

the oracle date datatype not store fractional seconds. if want store , recover milliseconds need change data type of column timestamp.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -