cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niclas Hedhman <nic...@localbar.com>
Subject Re: [seriously offtopic] Re: Bypassing Cocoon formatting for certainbrowsers
Date Tue, 08 Feb 2000 04:31:33 GMT
Ben Laurie wrote:

> -2 AD (== 3BC) -> -1 AD (== 2BC) -> 0 AD (== 1BC) -> 1AD (== 0BC) -> 2AD
> (== -1 BC).
>
> What's so hard about that?

Last note...

I know that for a programmer this would be a perfectly correct construction (see
"proof" below ), but...

Not all series of numbers are infinite in both directions. This is normally
called boundaries, and exists very often in the real world.
Now, I don't know who is the final authority (the Vatican?) in this subject, but
I am pretty sure that the inventor of the Julian calendar would not understand at
all (Romans did not use negative numbers, nor the digit Zero.) and I can't
imagine that the use of negative years has been endorsed by this authority,
whoever it is.


Niclas


import java.util.Calendar;
import java.util.GregorianCalendar;

public class DateTest
{
    static final String[] months = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };

    static public void main( String[] args )
    {
        try
        {
            GregorianCalendar ad = new GregorianCalendar();

            ad.set( Calendar.SECOND, 59 );
            ad.set( Calendar.MINUTE, 59 );
            ad.set( Calendar.HOUR_OF_DAY, 23 );
            ad.set( Calendar.DAY_OF_MONTH, 31 );
            ad.set( Calendar.MONTH, Calendar.DECEMBER );
            ad.set( Calendar.YEAR, 0 );
            ad.set( Calendar.ERA, GregorianCalendar.AD );
            System.out.println( "Year 0 AD, 31 December is computed as; " +
                                ad.get( Calendar.DAY_OF_MONTH ) + " " +
                                months[ ad.get( Calendar.MONTH ) ] + ", " +
                                ad.get( Calendar.YEAR ) +
                                (ad.get( Calendar.ERA ) == GregorianCalendar.AD ?
" AD" : " BC" ) +
                                " at " + ad.get(Calendar.HOUR_OF_DAY) +
                                ":" + ad.get(Calendar.MINUTE) +
                                ":" + ad.get(Calendar.SECOND) +
                             "" );

            ad.add( Calendar.SECOND, 1 );

            System.out.println( "and after Adding a single second; " +
                                ad.get( Calendar.DAY_OF_MONTH ) + " " +
                                months[ ad.get( Calendar.MONTH ) ] + ", " +
                                ad.get( Calendar.YEAR ) +
                                (ad.get( Calendar.ERA ) == GregorianCalendar.AD ?
" AD" : " BC" ) +
                                " at " + ad.get(Calendar.HOUR_OF_DAY) +
                                ":" + ad.get(Calendar.MINUTE) +
                                ":" + ad.get(Calendar.SECOND) +
                            ""  );
        } catch( Exception  e )
        {
            e.printStackTrace(System.err);
        }
    }

}



Mime
View raw message