DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 4 of 4
  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



Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links