Article View: comp.lang.java.programmer
Article #427Re: Days between GregorianCalendars
From: Marko Teittinen
Date: Thu, 30 Jul 1998 00:00
Date: Thu, 30 Jul 1998 00:00
20 lines
1537 bytes
1537 bytes
On Thu, 30 Jul 1998, Dag Welinder <welinder@bigfoot.com> wrote: > Is it possible to compute the number of days between two dates? I have > two instances of GregorianCalendar, each containing a date. Can I > compute the number of days between these two dates? 1) Get the long integer value from each of the dates (which represents the time in milliseconds since a fixed time, 1 Jan 1970, I think, but it's not important). 2) Subtract the smaller from the larger number and you get the difference between the two dates in milliseconds. 3) Divide by 1000*60*60*24 (number of milliseconds in a day) to get number of days between the dates. -- Marko Teittinen (marko@tekamah.com) | Please don't send me any Human-Computer Interaction Specialist | spam. My mail filter kills Tekamah Corporation | all incoming ads anyway.
Technical Details
Message-ID:
<slrn6s12bv.lil.marko@koan.tekamah.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<35C07780.DF0F02D4@bigfoot.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,14895c81839f4d37 X-Google-Attributes: gidf74b3,public X-Google-Thread: 113ae9,14895c81839f4d37 X-Google-Attributes: gid113ae9,public X-Google-Thread: 10a146,14895c81839f4d37 X-Google-Attributes: gid10a146,public From: marko@tekamah.com (Marko Teittinen) Subject: Re: Days between GregorianCalendars Date: 1998/07/30 Message-ID: <slrn6s12bv.lil.marko@koan.tekamah.com> X-Deja-AN: 376359753 References: <35C07780.DF0F02D4@bigfoot.com> Organization: Tekamah Corporation, Rockville, MD 20852 Newsgroups: comp.lang.java.programmer,comp.lang.java.help,borland.public.jbuilder.java.language