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)

Similar Messages

  • 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

  • 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 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();
            }

  • 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

  • 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

  • Problem with oracle.jbo.domain.Date and format 'dd.MM.yyyy'

    JBO-25009: Cannot create an object of type:oracle.jbo.domain.Date with value: 09.10.2003
    In EOImplMsgBundle :
    {"Dbeg_FMT_FORMATTER", "oracle.jbo.format.DefaultDateFormatter"},
    {"Dbeg_FMT_FORMAT", "dd.MM.yyyy"}};
    In VOImplMsgBundle :
    {"Dbeg_FMT_FORMAT", "dd.MM.yyyy"},
    {"Dbeg_FMT_FORMATTER", "oracle.jbo.format.DefaultDateFormatter"},
    Why ? Help Please

    I have the same problem !
    I have extended the formatinfo.xml with:
    <DOMAIN CLASS="oracle.jbo.domain.Date">
    <FORMATTER name="Simple Date" class="oracle.jbo.format.DefaultDateFormatter">
    <FORMAT text="dd.MM.yyyy" />
    <FORMAT text="dd-MM-yyyy" />
    <FORMAT text="yyyy-MM-dd" />
    <FORMAT text="yyyy-MM-dd G 'at' hh:mm:ss" />
    <FORMAT text="EEE, MMM d, ''yy" />
    </FORMATTER>
    </DOMAIN>
    And then I have set my attibutes to use this FORMATTER with FORMAT "dd.MM.yyyy".
    When I start my application, I became an error and the date-fields are blank ... The application can not convert my Date in 'dd.MM.yyyy' format ...
    When I set my attributes to Format Type <none>, it works, the date-fields are present ...

  • 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

  • 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())
      }

  • 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 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                                                                                                                                                                                                                                                                                       

  • How i convert string(dd/mm/yyyy) to java.util.Date object

    <%
       try{
             String date="1/8/2000";
             SimpleDateFormat ts= new SimpleDateFormat("dd-MMM-yyyy");
             Date  sqlToday = new java.sql.Date(ts.parse(date).getTime());
            out.println("I am Here");
             out.println("Date:"+sqlToday);
            out.println("After Date:");
             catch(ParseException e){
                  e.printStackTrace();
      %>It is the code and i cann't get any result.
    i am very new to JSTL and netbeans pls help me
    Thanks in Advance

    Write your format string to match the user input. ie yyyy-MM-dd (if that is what the user types in). MMM means month in short words - ie Jan, Feb, Mar etc
    Once you parse it into a date, and get a java.sql.Date, you should use a prepared statement and the setDate() method.
    Try
    dd/MM

  • Unknown user type: oracle.jbo.domain.Date exception from time to time. How to solve?

    Hi,
    This is the first time I am using Coherence to cache some lists in my ADF Application. This is my objects configuration file:
    <?xml version="1.0"?>
    <!DOCTYPE pof-config SYSTEM "pof-config.dtd">
    <pof-config>
        <user-type-list>
            <!-- coherence POF user types -->
            <include>coherence-pof-config.xml</include>
            <!-- com.tangosol.examples package -->
            <user-type>
                <type-id>1001</type-id>
                <class-name>package.dataproviders.TFDO1Services</class-name>
            </user-type>
            <user-type>
                <type-id>1002</type-id>
                <class-name>package.dataproviders.TFDO2Services</class-name>
            </user-type>
        </user-type-list>
        <allow-interfaces>true</allow-interfaces>
        <allow-subclasses>true</allow-subclasses>
    </pof-config>
    I have implemented the portableObject interface to each of my objects and they look like this:
        @Override
        public void readExternal(PofReader pofReader) throws IOException {
            this.tfMyList = (ArrayList<GenericRowData>) pofReader.readObject(0);
        @Override
        public void writeExternal(PofWriter pofWriter) throws IOException {
            pofWriter.writeObject(0, this.tfMyList);
    Please any help would be great!

    Hi Alejandro,
    Please note that when POF serialize collections it is somewhat lossy, in that when you deserialize the collection you may get a different collection implementation.  I.e. you're list will come out as a an implementation of java.util.List but not necessarily a java.util.ArrayList, so just cast to the List interface.  If you absolutely need a certain class impl type then you can use the readCollection method passing in the list you wish to have populated.
    thanks,
    Mark

  • How to convert string to an integer in SQL Server 2008

    Hi All,
    How to convert string to an integer in sql server,
    Input : string str="1,2,3,5"
    Output would be : 1,2,3,5
    Thanks in advance.
    Regards,
    Sunil

    No, you cannot convert to INT and get 1,2,3 BUT you can get
    1
    2
    3
    Is it ok?
    CREATE FUNCTION [dbo].[SplitString]
             @str VARCHAR(MAX)
        RETURNS @ret TABLE (token VARCHAR(MAX))
         AS
         BEGIN
        DECLARE @x XML 
        SET @x = '<t>' + REPLACE(@str, ',', '</t><t>') + '</t>'
        INSERT INTO @ret
            SELECT x.i.value('.', 'VARCHAR(MAX)') AS token
            FROM @x.nodes('//t') x(i)
        RETURN
       END
    ----Usage
    SELECT * FROM SplitString ('1,2,3')
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Cannot convert type class java.lang.String to class oracle.jbo.domain.Clob

    Cannot convert type class java.lang.String to class oracle.jbo.domain.ClobDomain.
    Using ADF Business Components I have a JSFF page fragment with an ADF form based on a table with has a column of type CLOB. The data is retrieved from the database and displayed correctly but when any field is changed and submitted the above error occurs. I have just used the drag and drop technique to create the ADF form with a submit button, am I missing a step?
    I am using the production release of Jdeveloper11G

    Reproduced and filed bug# 7487124
    The workaround is to add a custom converter class to your ViewController project like this
    package oow2008.view;
    import javax.faces.application.FacesMessage;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.convert.Converter;
    import javax.faces.convert.ConverterException;
    import oracle.jbo.domain.ClobDomain;
    import oracle.jbo.domain.DataCreationException;
    public class ClobConverter implements Converter {
         public Object getAsObject(FacesContext facesContext,
                                   UIComponent uIComponent,
                                   String string) {
           try {
             return string != null ? new ClobDomain(string) : null;
           } catch (DataCreationException dce) {
             dce.setAppendCodes(false);
             FacesMessage fm =
               new FacesMessage(FacesMessage.SEVERITY_ERROR,
                                "Invalid Clob Value",
                                dce.getMessage());
             throw new ConverterException(fm);
         public String getAsString(FacesContext facesContext,
                                   UIComponent uIComponent,
                                   Object object) {
           return object != null ?
                  object.toString() :
                  null;
    }then to register the converter in faces-config.xml like this
    <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee">
      <application>
        <default-render-kit-id>oracle.adf.rich</default-render-kit-id>
      </application>
      <converter>
        <converter-id>clobConverter</converter-id>
        <converter-class>oow2008.view.ClobConverter</converter-class>
      </converter>
    </faces-config>then reference this converter in the field for the ClobDomain value like this
              <af:inputText value="#{bindings.Description.inputValue}"
                            label="#{bindings.Description.hints.label}"
                            required="#{bindings.Description.hints.mandatory}"
                            columns="40"
                            maximumLength="#{bindings.Description.hints.precision}"
                            shortDesc="#{bindings.Description.hints.tooltip}"
                            wrap="soft" rows="10">
                <f:validator binding="#{bindings.Description.validator}"/>
                <f:converter converterId="clobConverter"/>
              </af:inputText>

Maybe you are looking for

  • Application working on WLSS 3.0 is not working on OCCAS 4.0

    Hi, I have an application working perfectly on WLSS 3.0, but now that we decide to work with OCCAS 4.0, the application stop working. For every INVITE that we generate we got an exception. In the begining I thouht that was something related with the

  • Delivery document Output Problem.

    Hello Gurus, I dont want to take the print ouot of delivery document if that delivery document is not PGI. Is there a standard config setting for this. Regards Prashant

  • How can I recover photos that have become corrupt

    Hi guys, having some trouble with old photos on my pc (windows 7), any help would be much appreciated. I have some old holiday photos on my pc in a specific folder . I had downloaded a password protection application and had set it up so that i had t

  • Possible to disable crtl+alt+del button on HP Slate 500?

    Hello I was wondering if it is even possible to disable the crtl+alt+del button on HP Slate 500? As my company has me reviewing the unit to be possibly used within our company but one of the requirements is to be able to lock the tablet down. And one

  • Aligning HP D4160 Printer

    I recently had to replace a cartridge in my HP Deskjet D4160 printer. Whenever I do this, I realign the carts using the HP printer maintenance utility. However, I've discovered that the align function no longer works. I assume this is related to the