🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #15717

Re: Date arithmeric

#15717
From: Omer Azhar Qureshi
Date: Mon, 03 May 1999 00:00
21 lines
1082 bytes
TIA,
u most probably wanna calculate the number of days b/w 2 dates, here is a
way 2 do that...

Calander cal1 = new GregorianCalendar();
Calander cal2 = new GregorianCalendar();

    // jan 01 1998
    cal1.set(1998, 1, 1, 0, 0, 0);
    // jan 01 1999
    cal2.set(1998, 1, 1, 0, 0, 0);

int iDayzBtwn = (int)((cal2.getTime() - cal1.getTime()) / (1000 * 60 * 60 *
24));

System.out.println (iDayzBtwn);  // displays 365

hope this helps....
if u need any thing else u know where to post the question....
regards
Oaq
Technical Details
Message-ID: <7gjqg1$3iu12@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <372B171D.A4741D23@t-online.de>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,aa14f67280334e52,start
X-Google-Attributes: gidf74b3,public
From: "Omer Azhar Qureshi" <oaq@systemeltd.com.pk>
Subject: Re: Date arithmeric
Date: 1999/05/03
Message-ID: <7gjqg1$3iu12@forums.borland.com>
X-Deja-AN: 473450143
References: <372B171D.A4741D23@t-online.de>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.0810.800
Organization: Another Netscape Collabra Server User
X-MSMail-Priority: Normal
Newsgroups: borland.public.jbuilder.java.language