https://www.techartifact.com/blogs/2013/09/converting-java-lang-string-to-oracle-jbo-domain-date.html
tions-
/** *Converts a String to oracle.jbo.domain.Date * @param String * @return oracle.jbo.domain.Date */ public oracle.jbo.domain.Date castToJBODate(String aDate){ DateFormat formatter; java.util.Date date; if (aDate!= null ){ try { formatter = new SimpleDateFormat( "dd/MMM/yyyy" ); date = formatter.parse(aDate); java.sql.Date sqlDate = new java.sql.Date(date.getTime()); oracle.jbo.domain.Date jboDate = new oracle.jbo.domain.Date(sqlDate); return jboDate; } catch (ParseException e) { e.printStackTrace(); } } return null ; } |
Another scenario –Convert oracle.jbo.domain.Date to String
Use this code-
public String convertJbodateToString(oracle.jbo.domain.Date domainDate){ SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss.S" ); Date date = null ; try { date = formatter.parse(domainDate.toString().substring( 0 , 21 )); } catch (ParseException e) { } SimpleDateFormat FORMATTER = new SimpleDateFormat( "MM/dd/yyyy HH:mm:ss" ); System.out.println( "NewDate-->" + FORMATTER.format(date)); return FORMATTER.format(date); } |