Re: Dates in Java


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Re: Dates in Java

  1. #1
    KW Guest

    Re: Dates in Java


    Hi All,
    I am trying to create a Date object and get
    the date in DD-MON-YY format.
    I see getDay(), getMonth() and getYear() methods are
    depricated.
    Any idea how can I go around it ?

    Thanks...KW

  2. #2
    Paul Clapham Guest

    Re: Dates in Java

    You would use a SimpleDateFormat object, and in particular its parse()
    method.

    PC2

    "KW" <kishore_wadhare@hotmail.com> wrote in message
    news:3cb1f38e$1@10.1.10.29...
    >
    > Hi All,
    > I am trying to create a Date object and get
    > the date in DD-MON-YY format.
    > I see getDay(), getMonth() and getYear() methods are
    > depricated.
    > Any idea how can I go around it ?
    >
    > Thanks...KW




  3. #3
    tex Guest

    Re: Dates in Java


    Hi
    Look at the java api for SimpleDateFormat class.
    It has extensive description with nice examples in its api docu.
    Tex...

    "KW" <kishore_wadhare@hotmail.com> wrote:
    >
    >Hi All,
    >I am trying to create a Date object and get
    >the date in DD-MON-YY format.
    >I see getDay(), getMonth() and getYear() methods are
    >depricated.
    >Any idea how can I go around it ?
    >
    >Thanks...KW



  4. #4
    Brian Guest

    Re: Dates in Java


    /* define the formating string (I think the formate is correct for what you
    want) */
    SimpleDateFormat sTestDateFormat = new SimpleDateFormat("dd-MMM-yy");
    // building a date
    TimeZone tz = TimeZone.getDefault();
    GregorianCalendar cal = new GregorianCalendar(tz, Locale.US);
    // printing out the formated date
    System.out.println(sTestDateFormat.format(cal.getTime()));

    "KW" <kishore_wadhare@hotmail.com> wrote:
    >
    >Hi All,
    >I am trying to create a Date object and get
    >the date in DD-MON-YY format.
    >I see getDay(), getMonth() and getYear() methods are
    >depricated.
    >Any idea how can I go around it ?
    >
    >Thanks...KW



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center