Thursday, January 30, 2014

How to convert java.util.Date to oracle.jbo.domain.Timestamp


In most of the scenarios, the date selected on the UI is of the format java.util.Date but the column store in the database will be of the format oracle.jbo.domain.Timestamp.




Convert Date to Timestamp

java.util.Date dateObj;
oracle.jbo.domain.Timestamp timestampObj = new oracle.jbo.domain.Timestamp(dateObj);



Convert Timestamp to Date

oracle.jbo.domain.Timestamp timestampObj;
java.util.Date dateObj = new java.util.Date(timestampObj.getTime());

1 comment: