converting date in string format to date format

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • krupalreddy
    New Member
    • May 2007
    • 2

    converting date in string format to date format

    i have a problem with date
    i have two dates. one is in Date type and the other one is in String type.
    i need to compare these two dates.
    for this i try to convert date which is in String type to Date type.is it possible?
    how?could you suggest the logic and methods?
  • sateesht
    New Member
    • Apr 2007
    • 41

    #2
    Hi

    Below is the Code which Converts String to Date Format:

    String str="2007050816 4500";
    SimpleDateForma t dateFormat=new SimpleDateForma t("yyyyMMddHHmm ss");
    ParsePosition p=new ParsePosition(0 );
    Date date=dateFormat .parse(str,p);
    System.out.prin tln(date);




    Cheers,
    Sateesh.

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Have a look at the SimpleDataForma t class and pay special attention to
      its parse method. The return value of that method is a Date.

      kind regards,

      Jos

      Comment

      • santoshsri
        New Member
        • Jan 2007
        • 48

        #4
        Hi ,

        I will have to convert Currency string into number format ..Please let me know how to do this.

        For example : I will have to format $32,000.00 as 32000 in C# .

        Comment

        • JosAH
          Recognized Expert MVP
          • Mar 2007
          • 11453

          #5
          Originally posted by santoshsri
          Hi ,

          I will have to convert Currency string into number format ..Please let me know how to do this.

          For example : I will have to format $32,000.00 as 32000 in C# .
          You're hijacking the wrong thread in the wrong forum; please ask your question
          in the C# forum; this is a Java forum.

          kind regards,

          Jos

          Comment

          Working...