number of date

Discussion in 'Java' started by Jay, Jan 2, 2004.

  1. Jay

    Jay Guest

    Hi,

    I have Calendar object for "begindate" and "enddate".
    is there easy way to get number of days in between?

    Thanks.

    -Jay
    Jay, Jan 2, 2004
    #1
    1. Advertising

  2. Jay

    Peter Kirk Guest

    "Jay" <> skrev i en meddelelse
    news:bt3vt2$2qbe$...
    > Hi,
    >
    > I have Calendar object for "begindate" and "enddate".
    > is there easy way to get number of days in between?


    Roedy Green's website may be a help:
    http://mindprod.com/jgloss/calendar.html
    Peter Kirk, Jan 2, 2004
    #2
    1. Advertising

  3. Jay

    Tony Dahlman Guest

    Jay wrote:
    >
    > Hi,
    >
    > I have Calendar object for "begindate" and "enddate".
    > is there easy way to get number of days in between?
    >
    > Thanks.
    >
    > -Jay


    Although I have never needed to use it, Roedy Green does supply a
    BigDate class that, no doubt, does this very well once you load
    the entire class.

    If you just want to subtract two dates, you might want to try
    this:

    http://pws.prserv.net/ad/programs/Programs.html#DateDiff

    Good luck and hope this helps. Regards, Tony Dahlman
    ---------------------------------------
    a (no spam)d ahlman( a t )att global( d o t )ne t
    Tony Dahlman, Feb 5, 2004
    #3
  4. Jay

    Tony Morris Guest

    "Tony Dahlman" <> wrote in message
    news:...
    > Jay wrote:
    > >
    > > Hi,
    > >
    > > I have Calendar object for "begindate" and "enddate".
    > > is there easy way to get number of days in between?
    > >
    > > Thanks.
    > >
    > > -Jay

    >
    > Although I have never needed to use it, Roedy Green does supply a
    > BigDate class that, no doubt, does this very well once you load
    > the entire class.
    >
    > If you just want to subtract two dates, you might want to try
    > this:
    >
    > http://pws.prserv.net/ad/programs/Programs.html#DateDiff
    >
    > Good luck and hope this helps. Regards, Tony Dahlman
    > ---------------------------------------
    > a (no spam)d ahlman( a t )att global( d o t )ne t



    (cal1.getTimeInMillis() - cal2.getTimeInMillis()) / (1000 * 60 * 60 * 24)

    --
    Tony Morris
    (BInfTech, Cert 3 I.T., SCJP[1.4], SCJD)
    Software Engineer
    IBM Australia - Tivoli Security Software
    (2003 VTR1000F)
    Tony Morris, Feb 5, 2004
    #4
  5. Jay

    Tony Dahlman Guest

    Tony Morris wrote:
    >
    > "Tony Dahlman" <> wrote in message
    > news:...
    > > Jay wrote:
    > > >
    > > > Hi,
    > > >
    > > > I have Calendar object for "begindate" and "enddate".
    > > > is there easy way to get number of days in between?
    > > >
    > > > Thanks.
    > > >
    > > > -Jay

    > >
    > > Although I have never needed to use it, Roedy Green does supply a
    > > BigDate class that, no doubt, does this very well once you load
    > > the entire class.
    > >
    > > If you just want to subtract two dates, you might want to try
    > > this:
    > >
    > > http://pws.prserv.net/ad/programs/Programs.html#DateDiff
    > >
    > > Good luck and hope this helps. Regards, Tony Dahlman
    > > ---------------------------------------


    >
    > (cal1.getTimeInMillis() - cal2.getTimeInMillis()) / (1000 * 60 * 60 * 24)
    >
    > --
    > Tony Morris
    > (BInfTech, Cert 3 I.T., SCJP[1.4], SCJD)
    > Software Engineer
    > IBM Australia - Tivoli Security Software
    > (2003 VTR1000F)


    That's good Tony (glib too :), and no doubt right.

    So how do you do this for months and years?

    Regards, Tony Dahlman
    ---------------------------------------
    Tony Dahlman, Feb 12, 2004
    #5
  6. Jay

    Tony Morris Guest

    > So how do you do this for months and years?
    >
    > Regards, Tony Dahlman
    > ---------------------------------------
    >


    Not so easily, but I did it in C++ many years ago for a university project.

    --
    Tony Morris
    (BInfTech, Cert 3 I.T.)
    Software Engineer
    IBM Australia - Tivoli Security Software
    (2003 VTR1000F)
    Sun Certified Programmer for the Java 2 Platform (1.4)
    Sun Certified Developer for the Java 2 Platform
    Tony Morris, Feb 12, 2004
    #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:
    563
    Matthew Speed
    Nov 8, 2003
  2. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,177
    Michael Borgwardt
    May 30, 2004
  3. Matt
    Replies:
    2
    Views:
    490
    Pete Becker
    Nov 8, 2003
  4. Matt
    Replies:
    3
    Views:
    687
    Richard Heathfield
    Nov 8, 2003
  5. Matt
    Replies:
    11
    Views:
    382
    Aaron Bertrand [MVP]
    Nov 8, 2003
Loading...

Share This Page