creating Date objects

Discussion in 'Java' started by jimgardener, Jun 11, 2008.

  1. jimgardener

    jimgardener Guest

    for running a sample program in sun's java tutorial(Employee program
    in Comparators section of object ordering) i need to create some Date
    objects with diff values for year ,month,day etc.Since Date(int year,
    int month,int day) is deprecated i can't use new Date(2001,02,23) to
    create a Date instance.How should i go about this?.can someone help?
    jim
     
    jimgardener, Jun 11, 2008
    #1
    1. Advertising

  2. jimgardener

    jimgardener Guest

    read the rest of the
    > Javadoc for the deprecated constructor, the part that begins
    > "replaced by ..."
    >


    sorry Eric...I need Date objects. i can't figure out how to get that
    from a Calendar instance..
    jim
     
    jimgardener, Jun 11, 2008
    #2
    1. Advertising

  3. jimgardener

    jimgardener Guest

    read the rest of the
    > Javadoc for the deprecated constructor, the part that begins
    > "replaced by ..."


    sorry about that..my mistakes!!shd have read carefully
    jim
     
    jimgardener, Jun 11, 2008
    #3
  4. jimgardener

    Roedy Green Guest

    On Wed, 11 Jun 2008 05:39:26 -0700 (PDT), jimgardener
    <> wrote, quoted or indirectly quoted someone who
    said :

    >for running a sample program in sun's java tutorial(Employee program
    >in Comparators section of object ordering) i need to create some Date
    >objects with diff values for year ,month,day etc.Since Date(int year,
    >int month,int day) is deprecated i can't use new Date(2001,02,23) to
    >create a Date instance.How should i go about this?.can someone help?
    >jim


    Date itself is pretty well deprecated. The tutorial is probably old,
    so just go ahead and use new Date.
    --

    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
     
    Roedy Green, Jun 11, 2008
    #4
  5. In article
    <>,
    jimgardener <> wrote:

    > read the rest of the
    > > Javadoc for the deprecated constructor, the part that begins
    > > "replaced by ..."
    > >

    >
    > sorry Eric...I need Date objects. i can't figure out how to get that
    > from a Calendar instance..
    > jim


    Doesn't Calendar's getTime() return a Date?

    "God marks time from the epoch; all else is the work of Sun." --with
    apologies to Kronecker ;-)

    John
    --
    John B. Matthews
    trashgod at gmail dot com
    home dot woh dot rr dot com slash jbmatthews
     
    John B. Matthews, Jun 11, 2008
    #5
  6. jimgardener

    Arne Vajhøj Guest

    Roedy Green wrote:
    > Date itself is pretty well deprecated. The tutorial is probably old,
    > so just go ahead and use new Date.


    Date is still absolutely necessary.

    Only the stuff replaced by (Gregorian)Calendar is deprecated.

    Arne
     
    Arne Vajhøj, Jun 17, 2008
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    1
    Views:
    619
    Matthew Speed
    Nov 8, 2003
  2. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,302
    Michael Borgwardt
    May 30, 2004
  3. Matt
    Replies:
    2
    Views:
    534
    Pete Becker
    Nov 8, 2003
  4. Matt
    Replies:
    3
    Views:
    735
    Richard Heathfield
    Nov 8, 2003
  5. J. Muenchbourg

    asp.net date objects vs. classic asp date objects

    J. Muenchbourg, Oct 3, 2003, in forum: ASP General
    Replies:
    1
    Views:
    180
    msnews.microsoft.com
    Oct 3, 2003
Loading...

Share This Page