How can i Convet String to oracle.jbo.domain.Date

Hi all,
How can i Convet String to oracle.jbo.domain.Date ?
Pls help its urgent?
Thanks
Amit

Hi
Try this hope this helps.
        oracle.jbo.domain.Date current_date = null;
        oracle.jbo.domain.Date current_date1 = null;
        String date = null;
        try{
            PreparedStatement st = getDBTransaction().createPreparedStatement("select trunc(sysdate) from dual",1);
            ResultSet result = st.executeQuery();
            while (result.next()) {
               date = result.getString(1);
               System.out.println("Sysdate:"+date);
            current_date = current_date1.toDate(date);
            System.out.println("Date Format:"+current_date);
        }catch(SQLException sqle){
            sqle.printStackTrace();
        }

Similar Messages

  • Converting string to oracle.jbo.domain.Date

    Hi,
    I am working in jdev 11.1.1.6
    I am getting date as string from UCM as string.I need to convert to oracle.jbo.domain.Date.How to achieve this

    u cn do by this
    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();

  • How to convert String (dd-MMM-yyyy) to oracle.jbo.domain.Date

    Hi
    Could you please tell how do I convert String of date in format dd-MM-yyyy to ADF date? Please show me some sample.
    Thanks

    http://javaalmanac.com/egs/java.text/FormatDateDef.html
    Once you have a java.util.Date you can convert it to oracle.jbo.domain.Date. (see http://www.fifkredit.com/bc4jdoc/rt/oracle/jbo/domain/Date.html)

  • How can i compare:  java.util.Date oracle.jbo.domain.Date?

    I have made a ViewObject wich contains a date column.
    I want to check if this date is smaller/greater than sysdate:
    i get following error:
    Error(45,24): method <(java.util.Date, oracle.jbo.domain.Date) not found in class Class4
    code:
    SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]);
    // set up rules for daylight savings time
    pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
    pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
    // create a GregorianCalendar with the Pacific Daylight time zone
    // and the current date and time
    Calendar calendar = new GregorianCalendar(pdt);
    Date trialTime = new Date();
    calendar.setTime(trialTime);
    (VO_ULNRow)singleRow = null;
    while(vo.hasNext()){                                             // ViewObject vo;
    singleRow = (VO_ULNRow)vo.next();
    if(calendar.getTime() < singleRow.getEO_ULN_BORROWFROM()); //singleRow returns oracle.jbo.domain.Date
    etcetera
    how can i compare those 2?

    Hi,
    oracle.jbo.domain.Date has two methods which suit your needs
    longValue() which returns a long (though I'm not sure if returns a long comparable to the long returned by java.util.Date)
    and dateValue() which returns a java.util.Date
    I hope it helps,
    Giovanni

  • Java.util.Date oracle.jbo.domain.Date how can i compare?

    I have made a ViewObject wich contains a date column.
    I want to check if this date is smaller/greater than sysdate:
    i get following error:
    Error(45,24): method <(java.util.Date, oracle.jbo.domain.Date) not found in class Class4
    code:
    SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]);
    // set up rules for daylight savings time
    pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
    pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
    // create a GregorianCalendar with the Pacific Daylight time zone
    // and the current date and time
    Calendar calendar = new GregorianCalendar(pdt);
    Date trialTime = new Date();
    calendar.setTime(trialTime);
    (VO_ULNRow)singleRow = null;
    while(vo.hasNext()){ // ViewObject vo;
    singleRow = (VO_ULNRow)vo.next();
    if(calendar.getTime() < singleRow.getEO_ULN_BORROWFROM()); //singleRow returns oracle.jbo.domain.Date
    etcetera
    how can i compare those 2?

    i get following error:
    Error(45,24): method <(java.util.Date,
    oracle.jbo.domain.Date) not found in class Class4
    if(calendar.getTime() <
    singleRow.getEO_ULN_BORROWFROM()); //singleRow returns
    oracle.jbo.domain.Date
    how can i compare those 2? You cannot compare these two values directly. You must convert the oracle.jbo.domain.Date object to a GregorianCalendar object. Something like:
      oracle.jbo.domain.Date dt = singleRow.getEO_ULN_BORROWFROM();
      GregorianCalendar gc = new GregorianCalendar(dt.getYear(), dt.getMonth(), dt.getDay());
      if (calendar.getTime() < gc.getTime())
      }

  • Getting Error:::oracle.jbo.domain.Date cannot be cast to java.lang.String

    Hi Friends,
    I have simple req'.
    i have one date filed in OAF page...if user has change the date filed..means if he incresed by 2 days..then i need to call one procedure..if not no need to call....
    first am picking that date field to by uusing prepared stmt and putting in to one variable..like below
    try {
    ps1 = am.getOADBTransaction().getJdbcConnection().prepareStatement("SELECT -------");
    ResultSet rs2 = ps1.executeQuery();
    while (rs2.next()) {
    schDate = rs2.getString(1);//storing the value
    } catch (Exception e) {
    throw OAException.wrapperException(e);
    Next..am picking the current value like this(user can change the value) like below...
    OAViewObject viewObj = (OAViewObject)am.findViewObject("simpleVO");
    String currSchDate = (String)viewObj.getCurrentRow().getAttribute("iDate");
    java.text.SimpleDateFormat dtFormat = new java.text.SimpleDateFormat ("MM/dd/yyyy");
    StringBuilder date = new StringBuilder(dtFormat.format(currSchDate));
    Then am comparing the values like below..
    if (schDate.equals(date)) {
    String outParamValue = "";
    String secondOutParamValue = "";
    but am geting the below error
    ## Detail 0 ##
    java.lang.ClassCastException: oracle.jbo.domain.Date cannot be cast to java.lang.String
         at xxuss.oracle.apps.abc.webui.xxPGCO15.processFormRequest(xxGCO15.java:594)
    Appriciate any help...its very urgent
    Regards
    Harry

    Instead of :
    String currSchDate = (String)viewObj.getCurrentRow().getAttribute("iDate");Try
    String currSchDate = viewObj.getCurrentRow().getAttribute("iDate").toString();
    -Anand

  • How do I use oracle.jbo.domain.Date truncate() method?

    Hello -
    I want to get the equivalent of "trunc(SYSDATE)" in the form of an oracle.jbo.domain.Date instance.
    I think I can do this by getting the current date and truncating the time portion:
    Date myDate = Date.getCurrentDate();
    myDate.truncate(some_precision_string);
    Issue is: what do I use for the precision string? (Javadoc for class (and its parent) is not helpful...)
    Thanks,
    -- Scott

    Nevermind. Apparently these methods don't really exist.
    (Although documentation in 9.0.3.3 JDev under Help -> Help Topics -> Contents Tab -> Reference -> Business Components Oracle Domains (this one is a javadoc page) say that they do....)

  • How to truncate oracle.jbo.domain.date

    Hi,
    I have problem to convert oracle.jbo.domain.date. Now I got current date from pagecontext, but it is yyyy-mm-dd hh:mi:ss format. I want to only yyyy-mm-dd, so I want to truncate the time from oracle.jbo.domain.date. And I want to got Date object not string. I found there is Date.truncate(), but I don't know how to use it.
    Could some one to help to give me a example?
    Best Regards,
    Eileen

    After spandig a lot of time with this I have found that the method is not implemented!!!
    Use this:
        public static oracle.jbo.domain.Date trunc(oracle.jbo.domain.Date dt,String fmt) {
            java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(fmt);
            String s= sdf.format(dt.getValue());
            java.sql.Timestamp ts;
            try {
                ts = new java.sql.Timestamp(sdf.parse(s).getTime());
                dt=new oracle.jbo.domain.Date(ts);
            } catch (ParseException e) {
            return dt;
        }To trunc to hours use format e.g. "dd.MM.yyyy HH"
    Karel
    Edited by: Karel.Redl on 26.11.2009 6:48

  • I can't  cast  java.util.Date to  oracle.jbo.domain.Date

    Hi, i have a variable "pippo" type java.util.Date formatted like (dd-MM-YYYY hh:mm:ss)
    and I want insert in my Database where the field is Date type(oracle.jbo.domain.Date)
    in the same format(dd-MM-YYYY hh:mm:ss).
    I try to convert "pippo" but the result is formatted(dd-MM-YYYY hh:mm:ss).
    Thank's a lot yours time and i'm very sorry for my easy english
    Bye Luca

    Here is what i have seen that works , but does not preserve milliseconds. Does anyone have other solution? Using dateValue() looses hours, mins and seconds.
    public oracle.jbo.domain.Date toJboDate(java.util.Date pJavaDate)
    return new oracle.jbo.domain.Date(new Timestamp(pJavaDate.getTime()));
    public java.util.Date toJavaDate(oracle.jbo.domain.Date pJboDate)
    return new Date(pJboDate.timestampValue().getTime());
    Chandresh

  • How to get oracle.jbo.domain.date from page to controller

    Hi All,
    I want to get date from my Advanced table bean to Controller. I am getting date as java.sql.Date i want to convert it to oracle.jbo.domain.Date. Any pointers in this will be helpful.
    Thanks in advance.
    With Regards,
    Anjani.

    get your date through ViewObject, you will get it in jbo.domain.date format
    vo.next().getAttribute("DateAttributeXXXX");
    --Prasanna                                                                                                                                                                                                                                                                                       

  • Business Components and oracle.jbo.domain.Date

    Hello I have the next problem I have a Busines Component and I have to acess to rows who have Dates and with oracle.jbo.domain.Date I can4t acess to the day, month, year .
    Can anyone Help me how can I do to access this dates?
    Thanks a lot your your help.

    Hi,
    This is the trilogy problem:
    oracle.jbo.domain.Date
    oracle.sql.DATE
    java.util.Date
    The question is how to translate from one object type to another.
    You can use the following:
    oracle.jbo.domain.Date tmpDate = null;
    SimpleDateFormat tmpLocalFormat = new SimpleDateFormat();
    SimpleDateFormat tmpLocalFormat2 = new SimpleDateFormat();
    // Obtenir la date du sommaire
    tmpDate = (oracle.jbo.domain.Date) session.getValue("DateElem");
    // Initialisation des objets de formatage de date
    tmpLocalFormat.applyPattern("yyyy-MM-dd");
    tmpLocalFormat2.applyPattern("dd-MM-yyyy");
    // Conversion du format de date yyyy-MM-dd => dd-MM-yyyy
    tmpWhereClause = new String(tmpLocalFormat2.format(tmpLocalFormat.parse(tmpDate.toString())));
    // Ajouter ` la clause "Where" la contrainte de la date
    tmpWhereClause = "DrqSommaireInitial.DATE_SOMMAIRE = TO_DATE('" + tmpWhereClause + "', 'DD-MM-YYYY')";
    Take a look also to class calendar...
    null

  • Oracle.jbo.domain.date

    hye all.i need help here.I'm developing a master detail using adf. My problem is i want to add month to a date..my date is in CoreSelectInputDate date1 while my month is in CoreInputText month. how to do this in oracle.jbo.domain.date..
    for example : date1 = 01/01/2008
    month = 5
    result date = 01/06/2008
    so how to get the result date.

    hye guys..i got some problem here..
    this is my code :
    import oracle.jbo.domain.Date;
    private CoreSelectInputDate tarikhterima;
    private CoreSelectInputDate tarikhtamat;
    public void checkDate(ValueChangeEvent valueChangeEvent) {
    Date now = (Date)getTarikhterima().getValue();
    System.out.println("tarikhterima :"+getTarikhterima().getValue().toString());
    String month = (String)valueChangeEvent.getNewValue();
    Date then = (Date)now.addMonths(Integer.parseInt(month));
    System.out.println("then :"+then);
    this.tarikhtamat.setValue(then);
    System.out.println("tarikhtamat :"+getTarikhtamat().getValue().toString());
    and this is the output :
    08/02/13 10:11:01 *************** CUSTOM PHASE LISTENER IN ACTION ***************
    08/02/13 10:11:05 tarikhterima :2008-07-18
    08/02/13 10:11:05 then :2008-09-18
    08/02/13 10:11:05 tarikhtamat :2008-09-18
    08/02/13 10:11:05 *************** CUSTOM PHASE LISTENER IN ACTION ***************
    08/02/13 10:11:09 tarikhterima :2008-09-18
    08/02/13 10:11:09 then :2009-01-18
    08/02/13 10:11:09 tarikhtamat :2009-01-18
    08/02/13 10:11:09 *************** CUSTOM PHASE LISTENER IN ACTION ***************
    08/02/13 10:11:12 tarikhterima :2009-01-18
    08/02/13 10:11:12 then :2009-06-18
    08/02/13 10:11:12 tarikhtamat :2009-06-18
    08/02/13 10:11:12 *************** CUSTOM PHASE LISTENER IN ACTION ***************
    my problem is the tarikhterima value is keep increasing..but the value shouldnt change at all.so can help me on this?

  • Convert java.sql.Date to oracle.jbo.domain.Date in oaf

    Hi,
    Need to dafault NeedBydate(i get in from query as below) to a messagelovinput and make it read only.
    i am facing some issue in converting from java.sql.Date to oracle.jbo.domain.Date.
    unable to figure out the problem.
    below is the sample code im trying to use.
    PreparedStatement ps=pageContext.createPreparedStatement("select sysdate from dual");
    ResultSet rs=ps.executeQuery();
    if (rs!=null && ps.next()
    java.sql.Date sqlDate= rs.getDate(1);
    oracle.jbo.domain.Date oracleDate = new oracle.jbo.domain.Date(sqlDate.getTime());
    vorow.setAttribute("Datevalue",oracleDate);
    this is my assumption : to set to UI i need date in format dd-Mon-yyyy.(am i correct? as to get that format i tried to use simple date format class but no use)
    when i tried to use simple date format :unpaseable date exception was raised.
    please guide.

    Hi,
    Why are you using this code???
    PreparedStatement ps=pageContext.createPreparedStatement("select sysdate from dual");
    ResultSet rs=ps.executeQuery();
    if (rs!=null && ps.next()
    java.sql.Date sqlDate= rs.getDate(1);
    oracle.jbo.domain.Date oracleDate = new oracle.jbo.domain.Date(sqlDate.getTime());
    you can get sysdate using this and then set it
    oracle.jbo.domain.Date currentDate = am.getOADBTransaction().getCurrentUserDate();
    java.text.SimpleDateFormat displayDateFormat = new java.text.SimpleDateFormat ("yyyy-MM-dd");
    String DateForm = displayDateFormat.format(currentDate.dateValue());
    oracle.jbo.domain.Date dateset = new oracle.jbo.domain.Date(DateForm);
    and then set the attribute
    vorow.setAttribute("Datevalue",dateset);
    Thanks,
    Gaurav

  • Casting oracle.jbo.domain.Date to java.util.Date and maintain more than day

    oracle.jbo.domain.Date now = getOADBTransaction().getCurrentDBDate();
    java.sql.Date currentDate = now.dateValue();
    will truncate the hour, minute, second etc.
    How can I avoid this?

    No luck with that either.
    oracle.jbo.domain.Date now = getOADBTransaction().getCurrentDBDate();
    and then
    java.sql.Timestamp currentDate = now.dateValue(); won't compile - gives class mis-match.
    java.sql.Timestamp currentDate = now.getTime(); won't compile - getTime doesn't exist even though code insight suggests it.
    java.sql.Timestamp currentDate = new java.sql.Timestamp(now.dateValue()); won't compile because no such constructor for Timestamp exists.

  • Oracle.jbo.domain.Date and JavaDoc

    Is there any javadoc for oracle.jbo.domain.Date etc?
    If not then what is the constructor?
    What format is the String passed in?....DD/MM/YY ???
    Can you pass in a java.util.Date to the constructor?
    Thanks,
    Paul.

    http://otn.oracle.com/jdeveloper/help/topic?inOHW=true&linkHelp=false&file=jar%3Afile%3A/u01/webapps/OHW/ohw-app/jdeveloper/helpsets/jdeveloper/reference/reference.zip!/bc4jdomorcldoc/oracle/jbo/domain/Date.html

Maybe you are looking for