Converting JBO timestamp to SQL timestamp

    public String jboTimeStampToSqlDateString(String fromdt){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
              java.util.Date dfromutil = null;
             try {
                dfromutil =  sdf.parse(fromdt);
             } catch (ParseException e) {
           
             }
              SimpleDateFormat dates = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
              System.out.println("Test:"+dates.format(dfromutil));
             
              String fromdtStr= dates.format(dfromutil);
              System.out.println("Date in string fromdtStr "+ fromdtStr);
              return fromdtStr;
    }


        oracle.jbo.domain.Timestamp fromdt = (oracle.jbo.domain.Timestamp)r.getAttribute("ValidFromDtHdr");
        oracle.jbo.domain.Timestamp todt = (oracle.jbo.domain.Timestamp)r.getAttribute("ValidToDtHdr");

        String fromdtStr =null;
        String todtStr =null ;
            if(fromdt!=null) 
            fromdtStr= jboTimeStampToSqlDateString(fromdt.toString());
            if(todt!=null)
            todtStr= jboTimeStampToSqlDateString(todt.toString());
        //CommonCode.getAM().getDBTransaction().rollback();
        //vo.setCurrentRow(r);
        String sqlproc2 = "{ call pi_prod_price_pkg.Ins_Cat_Offer_Price(?,?,?,?,?,to_date(?,'dd-mm-yyyy hh24:mi:ss'),to_date(?,'dd-mm-yyyy hh24:mi:ss'),?,?,?) }";
        

Comments