🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.java.help
Article #75

Re: HOW to get the intervall between 2 dates ???

#75
From: Jerome
Date: Sun, 04 Jun 2000 00:00
61 lines
2403 bytes
Thanxs
great!
i didn't think about that

jerome

elidan1 <elidan1NOelSPAM@zahav.net.il.invalid> wrote in message
news:071b9ecc.e2a9d4c6@usw-ex0105-038.remarq.com...
> In article <8hddtn$b51$1@news4.isdnet.net>, "Jerome"
> <nospam:jdeschars@yahoo.com> wrote:
> >HI
> >
> >i've got a pb ...
> >I want to get the interval between 2 dates !
> >
> >Should i use java.util.Date or java.util.calendar ??
> >
> >For example, if i have two dates:
> >   Date date1=new Date(20/05/2000);
> >   Date date2=new Date(12/06/2000);
> >
> >how can i get the number of days between these dates ??? (with
> the months of
> >31,30 or 28 days   ;-))  )
> >
> >
> >
> I'm sure there must be something fancier, but converting your
> dates to milliseconds, substracting them, dividing by the number
> of milliseconds in a day and converting back will work fine:
> .
>    long date1Milli = date1.getTime();
>    long date2Milli = date2.getTime();
>    long difference = date2Milli-date1Milli;
>    int daysBetween = (int)(difference/(1000*60*60*24));
> .
> BTW the Date constructor you are using is deprecated. Check the
> docs.
>
> >Thanks
> >
> >Jerome
> >
> >PS: sorry for my english, im French
> >
> >
> >
> >
> >
> >
> >
>
>
>
> elidan1
> for mail null IS null
> nullelidan1@nullzahav.net.il
> * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network
*
> The fastest and easiest way to search and participate in Usenet - Free!
>
Technical Details
Message-ID: <8hdqkr$2lsg$1@news6.isdnet.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <8hddtn$b51$1@news4.isdnet.net> <071b9ecc.e2a9d4c6@usw-ex0105-038.remarq.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 113ae9,c1edb2e3df598165
X-Google-Attributes: gid113ae9,public
X-Google-Thread: f6cb0,c1edb2e3df598165
X-Google-Attributes: gidf6cb0,public
X-Google-Thread: f74b3,c1edb2e3df598165
X-Google-Attributes: gidf74b3,public
From: "Jerome" <nospam:jdeschars@yahoo.com>
Subject: Re: HOW to get the intervall between 2 dates ???
Date: 2000/06/04
Message-ID: <8hdqkr$2lsg$1@news6.isdnet.net>
X-Deja-AN: 630916736
References: <8hddtn$b51$1@news4.isdnet.net> <071b9ecc.e2a9d4c6@usw-ex0105-038.remarq.com>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
X-Complaints-To: abuse@isdnet.net
X-Trace: news6.isdnet.net 960130523 87952 195.154.22.5 (4 Jun 2000 14:55:23 GMT)
X-MSMail-Priority: Normal
NNTP-Posting-Date: 4 Jun 2000 14:55:23 GMT
Newsgroups: comp.lang.java.help,borland.public.jbuilder.java.language,cn.bbs.comp.lang.java