🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.java.programmer
Article #422

Re: Days between GregorianCalendars

#422
From: Ricky
Date: Thu, 30 Jul 1998 00:00
25 lines
1382 bytes
This should help a bit

int days = 0;

                while(startDate.get(Calendar.YEAR) !=
endDate.get(Calendar.YEAR) ||
                      startDate.get(Calendar.MONTH) !=
endDate.get(Calendar.MONTH) ||
                      startDate.get(Calendar.DATE) !=
endDate.get(Calendar.DATE) )
                {
                      startDate.add(Calendar.DATE, 1);
                      days++;
                }


Dag Welinder wrote:

> Hello!
>
> 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?
>
> Regards, Dag Welinder
Technical Details
Message-ID: <35BFF39F.48935A9@sangacorp.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <35C07780.DF0F02D4@bigfoot.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 113ae9,14895c81839f4d37
X-Google-Attributes: gid113ae9,public
X-Google-Thread: 10a146,14895c81839f4d37
X-Google-Attributes: gid10a146,public
X-Google-Thread: f74b3,14895c81839f4d37
X-Google-Attributes: gidf74b3,public
From: Ricky <rforde@sangacorp.com>
Subject: Re: Days between GregorianCalendars
Date: 1998/07/30
Message-ID: <35BFF39F.48935A9@sangacorp.com>
X-Deja-AN: 376447813
Content-Transfer-Encoding: 7bit
References: <35C07780.DF0F02D4@bigfoot.com>
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0
Newsgroups: comp.lang.java.programmer,comp.lang.java.help,borland.public.jbuilder.java.language