I read a lot about "BigDate" - but it's shareware @ $10, I think. Never had
to use it myself but here's the link:

        http://mindprod.com/jgloss/bigdate.html#BIGDATE

There is also a very good tutorial on dates (see "Computer Dating" link),
here:

        http://java.sun.com/people/linden/intro.html

Specifically for what you're asking "... the number of years between 2
dates?" (are you sure you mean years?) try this:

        java.lang.Math.abs(
myDate1.getTime()-myDate2.getTime() )/1000/3600/24/365.25

i.e. get abs difference in millisecs and convert to years - but your version
of a year may vary (i.e. you may consider 365 to be a year)!

BTW to setup date values for testing try the following code:

        java.text.DateFormat df = new java.text.SimpleDateFormat( "yyyy.MMM.dd" );
        try {
                java.util.Date myDate1 = df.parse("1971.OCT.02");
                java.util.Date myDate2 = df.parse("1987.JAN.09");
                System.out.println( java.lang.Math.abs(
myDate1.getTime()-myDate2.getTime() )/1000/3600/24/365.25 );
        } catch (Exception ex) {
                System.out.println( ex.toString() );
        }

Hue.

> -----Original Message-----
> From: Butt, Dudley [mailto:[EMAIL PROTECTED]
> Sent: 26 August 2003 09:19
> To: 'Struts Users Mailing List'
> Subject: [OT] A date utility? anyone, pls help
>
>
> I know you guys are all excellent java programmers, so I do
> believe someone has what I'm looking for? I really please need a
> date utility class that
> accurately calculates the number of years between 2 dates? Would
> appreciate it very much thx!!
>
>
> NOTICE:
>
> This message contains privileged and confidential information intended
> only for the person or entity to which it is addressed.
> Any review, retransmission, dissemination, copy or other use of, or
> taking of any action in reliance upon this information by persons or
> entities other than the intended recipient, is prohibited.
>
> If you received this message in error, please notify the sender
> immediately by e-mail, facsimile or telephone and thereafter delete the
> material from any computer.
>
> The New Africa Capital Group, its subsidiaries or associates do not
> accept liability for any personal views expressed in this message.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to