How do u change a string to a Date object??

im using GregorianCalendar rite now to get dates..
n i got 2 dates - one is current date, the other is another date(How do i say this?? hmm.... ok, my birthday).
i had put them into "strings"
but i gotta check which date came 1st.(current, or my birthday)
i have found the method in Date.class, but before using the method, i gotta change the String to Date..
this is where i got stuck..
plz give me any info - codes, links, url, any things that helps..
Thz people..

SOrry for replying late..
i did catch the exception, n print out
catch(Exception e)
System.out.println(e); --> this is where it print out the error msg.
hmm, i tried to use the SimpleDateFormat class, as in in this link
http://forum.java.sun.com/thread.jsp?forum=31&thread=345037
the error shown up again, n with ("01/jan/2003");
i wanted it to be in all numbers like ("01/01/2003");
i think im confusing all of u now, coz i aint really good at explaining...
but here parts of my codes..
//edited code ---> using SimpleDateFOrmat
Date d1 = new Date();
Date d2 = new Date();
DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
d1 = df.parse(appDate); //appDate="01/01/2003"
d2 = df.parse(date); //date ="23/05/2003"
}catch(ParseException a){System.out.println(a);}
++++++++++++++++++++++++++++++++++++++++++++++++
//error msg
error: java.text.ParseException: Unparseable date: "(01/jan/2003)";
++++++++++++++++++++++++++++++++++++++++++++++++
//this is the orignal one
Date d1 = new Date();
Date d2 = new Date();
DateFormat df = DateFormat.getDateInstance();
d1 = df.parse(appDate); //appDate="01/01/2003"
d2 = df.parse(date); //date ="23/05/2003"
}catch(ParseException a){System.out.println(a);}
++++++++++++++++++++++++++++++++++++++++++++++++
//error msg
error: java.text.ParseException: Unparseable date: "(01/01/2003)";
++++++++++++++++++++++++++++++++++++++++++++++++
Hope someone out there knows what actually gone wrong..
n For those who reply or replied.. ThanK YOU!!!

Similar Messages

  • How can I change the language with the .dat (.bak) file?

    How can I change the language with the .dat (.bak) file? Is it legal?
    How does it work?
    Thanks for answering

    https://discussions.apple.com/message/17364930#17364930

  • How to make changes in company code global data

    Hi folks,
    Can some one suggest me how to make changes in company code global data (t code oby6). I want to assign 1 to co code > co Area which is blank.
    Thanks in advance

    Hi,
      actually if you want to change co code > co Area , it is under controlling (maintain controlling area), transaction code  OX06 .You change the assignment control and save it. It is automatic update you COmpany code global data.
    *give me a point if my answer solve your problem.
    Thank You.
    -akma-

  • How to add get Day value in a Date object?

    Hi,
    I am writing a sql statement that has two date values. One I am getting it from the database. The format in the database is MM/DD/YYYY. My first question is how do I convert the format into the java date format, YYYY-MM-DD. The second question is I need to find out what the day is and add 1 to it. How do I get Day value in a Date object?
    Thanks.

    Look at "SimpleDateFormat" and "parse" in the archives.

  • How to set change mode as default for workbench objects

    Hi experts
    I've always wondered if there is a configuration option in NW BW 7 where it can be set whether double clicking a workbench object will show the maintenance screen for that object in change or display mode (default is display). Because is annoying to have to set edit mode every time one double click a workbench object in the development system, and as it is a development system, it would make sense to have edit mode by default instead of display
    I was thinking that it may be related to the client role, but who knows...
    I appreciate your help
    regards

    Not sure where this can be set...if anywhere.
    But how about this for a workaround: Right click the object in RSA1 and the select Change instead of Display.
    That would save you a click if I counted correctly

  • How can I change the User Password expiry date

    Hi,
    I want to know how can I change the password expiration date of my user without changing his password. For eg:-
    User password expires on 12th May 2007. I want to extend to 12th Jun 2007. Is there any option in Oracle.
    Alter User <USERNAME> password expire .....<to new date>;

    The command is not alter user set expire...
    You should modify the user's profile, and set a timeframe:
    ALTER PROFILE DEFAULT LIMIT
    PASSWORD_LIFE_TIME = num_of_days;
    This way your password will be valid from the last time it was changed and for the time frame previously defined.
    ~ Madrid.

  • How Do I Convert a String that Names an Object to a Reference to the Object

    You get many program-specific object names in the XML that is returned by describeType.  Suppose I find an object that interests me.  What is the best way to convert the String that names the object (e.g. the id of the object) to a reference variable that points to the object? 

    Sure.  I am working on a complex application that involves several ViewStacks, several Accordions, some checkboxes, some radio buttons, some text boxes.  These components are scattered about, but all are children of a base class that is successfully enumerated by
    var classInfo:XML = describeType(vwstk);
    Suppose I write a loop as follows:
     for each (var a:XML in classInfo..accessor){
    Inside that loop I have a series of tests like
    if (a.@type == "mx.controls::CheckBox"{
    Then, I iterate thru all of the children of the base class as in:
    for  
    (var u:Object in vwstk)
    {        if  
    Inside the if I persist the checked/not checked status of the checkbox.
    The tricky part is going from the string a.@name to the Object reference u.  I doubt my proposed method will work.  Do you have a better idea?

  • How to find the last string value in dynamic object?

    Hi All,
    I am trying to find the last string value in dyanamic objects,Any one have solution for this.
    Ex:
    my data :12347-ebjdone-525-ecgfjf-25236-defdafgdeg
    And i want to show the output is :defdafgdeg
    Any ideas:
    Thanks
    Srini

    For oracle try using oracle function.
    e.g.
    SELECT  reverse(substr(reverse('12347-ebjdone-525-ecgfjf-25236-defdafgdeg'),1,instr(reverse('12347-ebjdone-525-ecgfjf-25236-defdafgdeg'),'-','1'))) from dual
    Object definition might look like:
    reverse(substr(reverse({ObjectName}),1,instr(reverse({ObjectsName}),'-','1')))
    Regards,
    Kuldeep
    Edited by: Kuldeep Chitrakar on Feb 12, 2010 8:12 AM

  • How can I change a string to a numeric when the numbers are separated by blank spaces?

    I would like to change a list of numbers in string to a list of number in numeric like in the attached vi. Unfortunately, the numbers are not separated by commas but by blank spaces. Which character can I use for the blank space?
    Ninskaya
    Attachments:
    readcommdelim.vi ‏19 KB

    Why don't you just use the Spreadsheet String to Array function instead. You can specify any delimiter you want. See the attached picture.
    Attachments:
    string_to_array.jpg ‏6 KB

  • How do I change this string  Please someone help this newbie :)

    Hi All
    I have a string which is a list of file in a folder. I am putting this list into a submenu. The files are formated like this
    Jesse_Smith_08_08_2001
    Jackie_Test_04_04_2000
    I would like to view them like this
    Jesse Smith 08.08.01
    Jackie Test 04.04.00
    How can I do this
    PLEASE HLEP ME
    I have spent 2 days trying to do this
    Craig

    Thanks for the code tolmark
    Can I ask one more this?
    How can I integrate your code into this code ??
    private void addItem(JMenu menu, char a)
        //Get file names from folder "Epod Configuration/Orders To Upload/"
        File dir = new File("Epod Configuration/Orders To Upload");
        File[] files = dir.listFiles();
        for (int j=0; j < files.length; j++)
          String trim = ""+files[j];
          int ndx;
          if ((ndx = trim.lastIndexOf('/')) != -1) trim = trim.substring(ndx+1);
          if (trim.charAt(0) == a);
          String s = trim;
          int idx = s.lastIndexOf('.');
          // remove extension
          if (idx != -1)
            s = s.substring(0, idx);
          System.out.println(s);
            JMenuItem mi = new JMenuItem(s);
            menu.add(mi);
      }sorry to have to ask but I just can't seam to do it .
    Thanks
    Craig

  • How can i change the Format of my DATE column?

    I need to change the date format for a whole column. At present i can do MM-DD-YYYY. I need to change this this to DD-MMM-YYYY.
    I know about the to_date function, i tried to apply it to change the format of my whole column by doing the following.....
    CREATE TABLE "IT220_DATEHOLIDAY"
    "DEPARTID" VarChar(2)NOT NULL ENABLE,
    "HOLCODE" VARCHAR2(2)NOT NULL ENABLE,
    "DEPARDATE" DATE,
    to_date('DATE','DD-MMM-YYYY'), <<<change DATE column to DD-MMM-YYYY
    CONSTRAINT "DATEHOLIDAY_PK" PRIMARY KEY ("DEPARTID") ENABLE
    ORA-00902: invalid datatype <<<<This was the error message i received.
    I am aware that the to_date function is supposed to be used to change strings into a certain format. I guess this means you cant do it with columns? Is there anyway i can format the whole column or do i have to do each string of data entered one by one?
    Thanks in advance!

    Hello Jay,
    I'm not sure you hit the right forum, as this doesn't seem to be a problem with APEX.
    Anyway:
    You can't use that function on a table like that, and as you already suggested, the to_date-function expects a string value.
    It seems you also have a misunderstanding of the basic datatypes in the database. DATE is such a datatype and is stored an internal format you don't need to care about. Each time your request the value, the database will give you a string representation according to either your locale or you give a certain formatting mask.
    The same applies to insert or update operations: you hand in either a variable of type DATE or use a function like to_date to create an "object" of type date.
    You may be interested in reading the documentation of the [url http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/toc.htm]Oracle Database Concepts. The section concerning datatype DATE can be found here:
    http://download.oracle.com/docs/cd/E11882_01/server.112/e16508/tablecls.htm#CBBGJHJC
    An overview of formatting options can be found here:
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/sql_elements004.htm#SQLRF00212
    So to answer your question: You would format it as part of your insert operation, taking a string and convert it using to_date.
    -Udo

  • How can I change the color of a single object?

    I have a bright orange barrel in a video of mine and I want to change it to a cooler color without changing the rest of the scene? How can I do this?

    Hi
    In FCP, under the help menu, choose Final Cut Pro Help.
    When it opens, search for " Using the Limit Effect Controls of the Color Corrector Filter to Change a Specific Color".
    MtD

  • How do I change the format of the date to dd-mm-yyyy?

    At the moment, the entries will not be accepted unless they are in the format of mm-dd-yyyy which will not go down well on what I am trying to do?
    Any advice on how to change the format?
    Thanks

    Hi Keri,
    I can understand your concern & will help you to get this issue resolved.
    Window where you Insert date in Add Header & Footer, you will get the option of 'Page Number and Date Format'. Please click on it.
    Page Number and Date Format window will pop up on your screen, now you can select the date format from the drop-down list & click on OK to confirm the changes. Please refer to the screenshot below.
    Let me know if you still experience any issue.
    Regards,
    Aadesh

  • How can I change the default start-up date for a new functional location?

    Is there a way to change the default date when creating a functional location? Whenever we create a new functional location, there is a date populated in the start-up date field. This date is our go-live date from last year and I cannot find the location in the IMG (if there is one) to stop the date from automatically populating with the date from the superior functional location. I tried setting the field from input to required but the date still populates automatically. Does anyone have any suggestions on how to leave the start-up date field blank when creating a new functional location?

    That field is generally picked up from the immediate superior FL in the hierarchy through the inheritance functionality.You will have to overwrite this date.I dont think you can clear this field through Configuration functionality.
    If you are in Ecc 6.0, you could get the help of developer to use implicit enhancement to initialize the field contents.
    Regards
    Narasimhan

  • How Can I change the color in a 3d object?

    Hello.
    I have received a 3dPDF, on which several buildings are created in 3d. Is it possible afterwards to change the color of the buildings in Acrobat X Pro? Or do I need the plugin "Tetra4D"?
    Thank you for your help.
    Greeting
    Sascha

    You can change the color of model parts dynamically at runtime using JavaScript, but there is no way to change them within the embedded model itself.

Maybe you are looking for

  • Receive iMessage and SMS text in one window

    I was wondering if anyone knows of a setting or whether its even possible to receive an iMessage from an iPad and a SMS text from a non Apple phone within one chat window when they both are coming from the same person. Someone text's me throughout th

  • My 'run with administrative privileges' script no longer works - help

    Hey all. I have an applescript that shuts down the computer that I made a while back. I pulled it out today to use it and it no longer works. Here's part of the code I'm having trouble with: do shell script ¬ "sudo shutdown -h now" password "myadminp

  • Two operating systems, one library

    I'm using iTunes 7.0.2.16 on Windows XP Pro with no problems. I just installed a dual-boot of Windows Vista RC2 for fun, and installed iTunes within Vista as well (in a separate "Program Files" folder, of course) but I can't access the XP iTunes libr

  • Need to pull postal code in SO from customer master instead on postlcd/city

    I want  postal code to be pulled in sales order - partners tab for  bill to party from customer masater/ under PO box adress. Currently it is pulling postal code/city from customer master/ under street address. Is there any standard con-fig available

  • How to validate the valid email

    Hi all i have a creation page in that page email field is ther .while saving the transaction i need to check that email is a valid email or not how can we achieve this functionality Regards Sreekanth