Converting Date Object

plz help me,
I want Date in simple format as dd/mm/yyyy.
I am retrieving date from database (oracle) and now i want to convert that date to simple "dd/mm/yyyy"
e.g : date_from_oracle=Wed Feb 01 09:10:59 GMT+05:30 1950
converted_date=1/2/1950 (and this should be date object and not String)
System.out.println("converted date:" + converted_date);
above line should print : converted date:1/2/1950
if u r clear with my question then plz help me
Thanks

No my problem is that i am developping J2EE
application where i am getting date values in EJB
that i want to display on JSP page.
For this i am using struts and passing collection of
data values to it.That shouldn't make the solution any different.
My oracle date format is 01-Jan-2005 (dd/mmm/yyyy).
In my ejb there is one attribute named "date_display"
of type Date. In Struts Action i retrieved collection
of all dates from database that i want to display on
JSP page as it is without any parsing. Then you should not bother about the format.
If i iterate above collection in JSP page it displays
date along with GMT and Time format. I dont want
this. I want to set "date_display" in such a way that
it should contain date values but in simple format as
"1-Jan-2005 OR 1/1/2005". Important thing is that the
Setter Method for date_display accepts parameter of
Date type. So even SimpleDateFormat also not useful.If it is not useful, write your own method. <_<
please help me out as i am stuck there.
System.out.println(new SimpleDateFormat("dd/MM/yyyy").format(new Date()));

Similar Messages

  • BSP Exception: Missing reference when converting data object ZZxx

    Hi there,
    I have created these new Z fields and tried to include them in a field group. These fields did appear, but they are highlighted with a red box, with the above text in the tool tip.
    Does anyone know what it means??
    Thanks

    I believe they were generated by EEWB - or could've been added manually to the CRMD_CUSTOMER_H. This error only occurs on the Currency fields...something to do with reference field but I just can't find what is wrong with this. I searched up SAP notes and found the following the closest match: -
    <b>Symptom</b>
    when trying to scroll down in the result list in the F4 for the Ibase the error error "BSP exception : Missing reference when converting data object amount.  Correct the entry" occurs.
    <b>Other terms</b>
    CRMT_BSP_IBASE_TREE_NF, data object amount
    <b>Reason and Prerequisites</b>
    This happens due to inconsistancy in structure
    <b>Solution</b>
    Please follow the below steps manually.
    1. Go to tx:SE11
    2. Select data type "CRMT_BSP_IBASE_TREE_NF" in change mode
    3. Select component AMOUNT in 'Components' tab
    4. Go to "Currency/quantity fields" tab
    5. Replace 'Reference table' entry from 'CRMT_BSP_IBASE_DETAIL'
       to 'CRMT_BSP_IBASE_TREE_NF'
    6. Save and activate

  • How to convert date object format to new?

    Hi,
    I have data object and I want to convert it to this format.
    DD MMM YYYY
    eg: 23 MAR 2003
    I am looking for exact line of code please.
    Thanks,
    Kavans.

    You should check out the Javadoc for java.text.DateFormat and java.text.SimpleDateFormat.
    As for the exact line of code then this would be close:
    Date date = ...; // wherever your date comes from
    DateFormat dateFormat = new SimpleDateFormat("dd MMM yyyy");
    String dateAsString = dateFormat.format(date);Remember to check out those Javadocs, though, 'cos they'll tell you the various formatting options available.
    Hope this helps.

  • Convert Date Object to Calendar object

    Hi,
    I have a Date field in my webdynpro application, I need to to read this from my current context and convert the same to a Calendar field and pass it to my model.
    Calendar date = CalendarConverter.parseDate(req_date.toString());
    The above code gives me a null pointer exception.
    Can anyone suggest me the right way of converting a Date object to Calendar object?
    Ashwini.

    Ashwini,
    try to use the following code snippet:
    // get calendar and set your date object
    Calendar c = Calendar.getInstance();
    c.setTime( <YOUR_DATE_OBJECT> );
    // to manipulate the fields use this
    c.set(Calendar.MONTH, 1);
    // to manipulate retrieve a fields use this
    c.get(Calendar.MONTH);
    Hope that helps you.
    Sebastian Voss

  • How to Convert Date Object at Universe Level with out Timestamp

    Hi,
    I have a Object  called "PCREGISTERDATE" at universe where the data type is date .but the dates are coming in the following format:9/26/2007 9:48:40 PM but i want to show the date as with out time stamp.
    how can i create a object by at universelevel which shoul show only date with out Time Stamp.
    please help me on this ASAP.
    Thanks & Regards,
    Kumar

    Please try below date fucntion:
    select convert(varchar(10),getdate(),101)  - this is for sybase
    syntex will change based on your source database.
    Thanks
    Ponnarasu .K

  • How to convert  a date object to gregorianCalendar

    hi,
    I need to convert Date object to a gregorian calendar object. Can anyone tell me how to do that?
    thanx

    GregorianCalendar gc = new GregorianCalendar();
    gc.setGregorianChange(new Date(Long.MIN_VALUE))
    gc.setTime(new Date());

  • Date object to RichInputDate

    Hello,
    How can i convert Date object to RichInputDate
    Vice versa was possible bt i want it other way round

    Converting RichInputDate to specific format
    https://kr.forums.oracle.com/forums/thread.jspa?threadID=2242338

  • Converting Date.toString() back to a Date object for compare

    I know this is beating a dead horse to death but I have wasted a whole day trying to get this to work. Here is the problem.
    I need to convert a Date().toString (format returned: Dec 19, 2006 3:39:58 PM EST) back to a Date object. What I am doing is writting this string a text file and then revisiting it to compare later to a current Date object to find the difference in the two stamps in milliseconds.
    J2SE 1.4.2 being used
    Date date = new Date();
    String newDateStr = log[1].trim(); // entry from log file
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date logDate = dateFormat.parse(newDateStr);
    // get difference between the two
    long timeSpan = date.getTime() - logDate.getTime();
    if(timeSpan > 60000){
        // TO DO
    }So should I look at a different approach at either:
    A) Storing the date/time stamp in the text file
    B) The conversion back to Date object is wrong
    Really appreciate any insight on this.
    Thanks
    JLW
    Message was edited by:
    jlwestsr

    Then my friend you are in the same status as Tim.:o)
    I don't know as much as him and I don't care to write
    an elaborate reply most of the time. :D
    Merry ChristmasSame to you.I don't pretend to know that much, but When I see something I do know, I tend to give examples.
    Most probably that is because at the present time I am in a situation where most of my time is spent waiting for a call from the customer, and the app I am supporting works so well that those calls are few and far between. Lucky for me, they pay me for sitting around and answering questions on a forum.
    At least it is a java forum, where I can justly claim that I am improving my knowledge of java.
    ~Tim

  • Convert a calendar object to a date object

    hi all...i use a calendar to select date and i want to convert the Calendar object returned to a date object ..how could i do that ?? i use the following lines of code but the Date object returned is not correct ..i mean it's not the one i chose from the calendar
    Date selectedDate=new Date();
    selectedDate=(calendar1.getTime());
    Any one could help....thank you

    Show us the code where you set the calendar to your desired value. Calendar1.getTime()
    should return the relevant date.

  • How to convert server specific date string into client specific date object

    Hi developers,
    I have a very complex issue to convert the server date string format "EEE MMM dd HH:mm:ss z yyyy" into java.util.Date object and find the difference of the client machine date to represent the elapsed time
    The problem is the server time zone and client time zone are not unique and when I try to covert the server date which is in string format to date format using SimpleDateFormat class , I got the server time as 3:30 hours appended to it. The server time zone is in IST and Client time zone format is GMT+5:30 , the appended time of 3:30 hours created the confusion in calculating the elapsed time between the server started time and client requested time
    I went through all the sites but none of them were useful
    If any help to solve the above issue is appriciated
    please send the response with the same subject line
    Advance Thanks

    Why don't you just subtract from the server time the 3:30 hours (consult api of java.util.date) before comparing with the client date? Hard to see where's the problem...

  • How to convert a string to date object?

    I have a string user input for date.
    I want to convert it to Date object to insert it in database.
    How to do it?

    Check the java.text.SimpleDateFormat class. You can use it for parsing dates. API contains good description how to build the format pattern.
    HTH
    Mike

  • Convert RichInputDate to Date object

    Hi,
    I'm using af:inputDate in my form.
    in my backing bean i'm trying to get the value as Date object.
    public RichInputDate getFromDate() {
    return fromDate;
    public void convert(){
    Date fromDt = (Date)this.getFromDate().getValue();
    but I get this error:
    java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date
    any idea?
    is there a simple way to get the value as Date object.
    Thanks!

    Converting RichInputDate to specific format
    https://kr.forums.oracle.com/forums/thread.jspa?threadID=2242338

  • Move Data from Converted Database Objects Successfully Finish ?

    I am using SQL Developer 3.2.20.09 try to migrate KSMMS database from SQL Server 2008 to Oracle 11g R2. After the migration process is done, the Captured Database Objects model, and Converted Database Objects model have been created in the Migration Projects Navigator panel on the left side, and the corresponding sql scripts has been generated in the project output directory. I run the sql scripts, it created all the tables, views, index and stored procedures in the oracle database, everything seems working perfectly. However when I try to Move Data (by right clicking Converted Database Objects) and try to move all the data from SQL Server to Oracle database, the Data moving process run less then 1 minute, and show me the result as Data Move successfully. I have about 1 GB data in the SQL Server database, it seems nothing has been moved into Oracle DB. Here are the detail structures of MS SQL Server Database which I am trying to migrate to Oracle:
    The SQL Server Database name is KSMMS, under that database there are 9 users (azteca, cwweb, dbo, guest, plladmin, pw, pwadmin, tbills, wsdadmin). All my application objects (tables, views, indexes, procedures) are under azteca user, during the migration process, Converted Database Objects creates user azteca_KSMMS and dob_KSMMS, all my application objects have been created under azteca_KSMMS user schema. The generated .sql scripts actually can create all the objects under azteca_KSMMS schema, however when I try to Move Data, nothing has been moved into Oracle database. I opened an SR#3-6708733861 last Friday, it seems Oracle Support can't find what cause the problem during the Data Move process. Any help regarding my questions will be highly appreciated. Thanks.
    Kevin

    I changed Data Move Mode to Online and run the Data Move again. Same Results: Migration action have completed successfully. However no records have been moved into Oracle tables.
    I am running SQL Developer under Windows 8 Operation system. There is no Oracle client software available for Windows 8, does that cause any problems?
    Kevin

  • Data objects in Unicode cannot be converted dump

    Hi experts,
    I am using a Custom business object which if run independently throws no error. We are upgrading 4.6 to ECC 6.0.It is unicode active.
    The Business object contains methods for displaying a scanned document from IXOS server.
    On executing work item (for decision step), there is a scanned document which shows up in a window. On closing the window,
    there is a short dump with text 'Data objects in Unicode cannot be converted dump'.
    There are both Before Work item execution method and an After Work item execution method attached in the Methods tab of the task.
    In the After Work item method there is ARCHIVWINDOW_CLOSE function module used. Could there be a problem with this?
    Please help.
    Regards,
    Garima.

    Actually, there is no problem in Workflow.It is because we are upgrading from 4.6 to ECC 6.0.
    I have used CREATE OBJECT ole class and FREE OBJECT statements.
    There is a dump ' Data objects in Unicode cannot be converted dump ' from function AC_FLUSH_CALL_INTERNAL
    occuring when FREE OBJECT statement is executed.
    Please suggest a solution to this.
    Regards,
    Garima.

  • Issue with converting string to date object

    Hi all,
    I have a problem with sorting a list of dates in a table column. My dates are in the format 'yyyy-Mmm-dd'(Eg: 2009-Dec-23). Can someone help me how to sort the dates in this format. here is the code which i tried.
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-Mmm-dd");
              Date d1= new Date();
              Date d2= new Date();
              try {
                   d1 = dateFormat.parse("2006-Jun-09");
                 d2 = dateFormat.parse("2006-Apr-10");
              } catch (ParseException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              System.out.println("converted date 1"+ d1);
             System.out.println("converted date 1"+ d2);
    Exception : Unparseable date: "2006-Jun-09"
         }Please someone help me how to pass this date in the right format.

    I believe twisai may have lost the documentation so he/she can figure this out rather than guess that "Mmm" means 3-letter month, first letter capitalized. Let me remind him of the link:
    [http://java.sun.com/javase/6/docs/api/index.html]

Maybe you are looking for

  • ICal on Mac Pro will not sync to iPhone calendar

    iCal-to-iPhone calendar sync seems to be busted. If I create an event on iCal on my Mac Pro (running OS X, 10.7.5), the Calendar app on my iPhone 4s (Model A 1387, running iOS 7.0.4) will not show it. It used to sync fine, using either WiFi or plug-i

  • Kernel Panic in Brand New (replacement) Early-2013 rMBP

    Hello all, I recently had to have my 4 month old rMBP replaced because of a weird sleep/wake/shutdown flashing screen issue.  They tried to repair the old machine 4 times and eventually just replaced it.  I have been using the brand new out of the bo

  • LG Octane Camera Date/Time Stamp Issues

    The pics I take with my LG Octane are designated a number associated with the date/time the pic was taken (ex 0401121345, would be April 1, 2012 at 145pm). When I transfer the pics from my phones memory card to my computer and open the pics, I can se

  • Add Button in Table.....

    Hi Guys,              My requirement is: In a table control, 2 fields are coming from one node and third field is button. If i'm clicking on this button, the relevant field values are coming from the another database table (Here it may be more than 1

  • Java.lang.ClassNotFoundException: oracle.stellent.ridc.IdcClientManager

    Hi All, Jdeveloper 11.1.1.6 with WC Extension Included RIDC Library in my project Integrated WLS has the oracle.ucm.ridc.app-lib(11.1.1,11.1.1) as a shared library present. I get the error as in the subject when I run my application and try to check