Java says the year 0 is a leap year but year 0 never existed

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
6
down vote

favorite
1












I was writing some test cases for some convenience methods that I am updating and decided to see what would happen if I used LocalDate's isLeapYear() method on the year 0. As I understand it, year 0 never actually existed: the year before 1 AD was 1 BC. (This is based on an article I read many years ago whose source I have long forgotten.) Much to my surprise, my test indicated that the year 0 wa a leap year!



I realize that the java.time.LocalDate class implements ISO-8601 but does ISO-8601 really indicate that the year 0 existed? I'm reluctant to believe that the people who tested LocalDate would have missed this as a test case but I'm also reluctant to believe that an international standard like ISO-8601 would make such an obvious mistake.



The other possibility is that the article I read was just flat-out wrong. (Or it was correct then but was rethought later.)



This is not hugely important but I am curious to know where the mistake is: ISO-8601, Java's LocalDate class, or my understanding of how time is reckoned.










share|improve this question





















  • This would be a great Jon Skeet question.
    – Ryan The Leach
    5 hours ago










  • Thanks, everyone! I'm glad to see that LocalDate doesn't have an obvious error in it. I'm going to have to get used to thinking of a timeline like a thermometer with negative, zero and positive values again....
    – Henry
    3 hours ago














up vote
6
down vote

favorite
1












I was writing some test cases for some convenience methods that I am updating and decided to see what would happen if I used LocalDate's isLeapYear() method on the year 0. As I understand it, year 0 never actually existed: the year before 1 AD was 1 BC. (This is based on an article I read many years ago whose source I have long forgotten.) Much to my surprise, my test indicated that the year 0 wa a leap year!



I realize that the java.time.LocalDate class implements ISO-8601 but does ISO-8601 really indicate that the year 0 existed? I'm reluctant to believe that the people who tested LocalDate would have missed this as a test case but I'm also reluctant to believe that an international standard like ISO-8601 would make such an obvious mistake.



The other possibility is that the article I read was just flat-out wrong. (Or it was correct then but was rethought later.)



This is not hugely important but I am curious to know where the mistake is: ISO-8601, Java's LocalDate class, or my understanding of how time is reckoned.










share|improve this question





















  • This would be a great Jon Skeet question.
    – Ryan The Leach
    5 hours ago










  • Thanks, everyone! I'm glad to see that LocalDate doesn't have an obvious error in it. I'm going to have to get used to thinking of a timeline like a thermometer with negative, zero and positive values again....
    – Henry
    3 hours ago












up vote
6
down vote

favorite
1









up vote
6
down vote

favorite
1






1





I was writing some test cases for some convenience methods that I am updating and decided to see what would happen if I used LocalDate's isLeapYear() method on the year 0. As I understand it, year 0 never actually existed: the year before 1 AD was 1 BC. (This is based on an article I read many years ago whose source I have long forgotten.) Much to my surprise, my test indicated that the year 0 wa a leap year!



I realize that the java.time.LocalDate class implements ISO-8601 but does ISO-8601 really indicate that the year 0 existed? I'm reluctant to believe that the people who tested LocalDate would have missed this as a test case but I'm also reluctant to believe that an international standard like ISO-8601 would make such an obvious mistake.



The other possibility is that the article I read was just flat-out wrong. (Or it was correct then but was rethought later.)



This is not hugely important but I am curious to know where the mistake is: ISO-8601, Java's LocalDate class, or my understanding of how time is reckoned.










share|improve this question













I was writing some test cases for some convenience methods that I am updating and decided to see what would happen if I used LocalDate's isLeapYear() method on the year 0. As I understand it, year 0 never actually existed: the year before 1 AD was 1 BC. (This is based on an article I read many years ago whose source I have long forgotten.) Much to my surprise, my test indicated that the year 0 wa a leap year!



I realize that the java.time.LocalDate class implements ISO-8601 but does ISO-8601 really indicate that the year 0 existed? I'm reluctant to believe that the people who tested LocalDate would have missed this as a test case but I'm also reluctant to believe that an international standard like ISO-8601 would make such an obvious mistake.



The other possibility is that the article I read was just flat-out wrong. (Or it was correct then but was rethought later.)



This is not hugely important but I am curious to know where the mistake is: ISO-8601, Java's LocalDate class, or my understanding of how time is reckoned.







java time






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 5 hours ago









Henry

23219




23219











  • This would be a great Jon Skeet question.
    – Ryan The Leach
    5 hours ago










  • Thanks, everyone! I'm glad to see that LocalDate doesn't have an obvious error in it. I'm going to have to get used to thinking of a timeline like a thermometer with negative, zero and positive values again....
    – Henry
    3 hours ago
















  • This would be a great Jon Skeet question.
    – Ryan The Leach
    5 hours ago










  • Thanks, everyone! I'm glad to see that LocalDate doesn't have an obvious error in it. I'm going to have to get used to thinking of a timeline like a thermometer with negative, zero and positive values again....
    – Henry
    3 hours ago















This would be a great Jon Skeet question.
– Ryan The Leach
5 hours ago




This would be a great Jon Skeet question.
– Ryan The Leach
5 hours ago












Thanks, everyone! I'm glad to see that LocalDate doesn't have an obvious error in it. I'm going to have to get used to thinking of a timeline like a thermometer with negative, zero and positive values again....
– Henry
3 hours ago




Thanks, everyone! I'm glad to see that LocalDate doesn't have an obvious error in it. I'm going to have to get used to thinking of a timeline like a thermometer with negative, zero and positive values again....
– Henry
3 hours ago












2 Answers
2






active

oldest

votes

















up vote
6
down vote



accepted










From the LocalDate Javadoc:




It is equivalent to the proleptic Gregorian calendar system, in which today's rules for leap years are applied for all time. For most applications written today, the ISO-8601 rules are entirely suitable. However, any application that makes use of historical dates, and requires them to be accurate will find the ISO-8601 approach unsuitable.




Wikipedia has more information on the proleptic Gregorian calendar. Among other things, it says:




Mathematically, it is more convenient to include a year 0 and represent earlier years as negative, for the specific purpose of facilitating the calculation of the number of years between a negative (BC) year and a positive (AD) year. This is the convention used in astronomical year numbering and in the international standard date system, ISO 8601. In these systems, the year 0 is a leap year.




Note that this has nothing to do with the AD/BC versus CE/BCE terminology: those names are only used for referring to which era of years is being used, not the calendar in use.






share|improve this answer


















  • 1




    Good to know they know about their limitations. Nice find.
    – Alain Cruz
    4 hours ago

















up vote
4
down vote













From Wikipedia:




...there is a year zero in astronomical year numbering (where it coincides with the Julian year 1 BC) and in ISO 8601:2004 (where it coincides with the Gregorian year 1 BC)







share|improve this answer






















    Your Answer





    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52921032%2fjava-says-the-year-0-is-a-leap-year-but-year-0-never-existed%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    6
    down vote



    accepted










    From the LocalDate Javadoc:




    It is equivalent to the proleptic Gregorian calendar system, in which today's rules for leap years are applied for all time. For most applications written today, the ISO-8601 rules are entirely suitable. However, any application that makes use of historical dates, and requires them to be accurate will find the ISO-8601 approach unsuitable.




    Wikipedia has more information on the proleptic Gregorian calendar. Among other things, it says:




    Mathematically, it is more convenient to include a year 0 and represent earlier years as negative, for the specific purpose of facilitating the calculation of the number of years between a negative (BC) year and a positive (AD) year. This is the convention used in astronomical year numbering and in the international standard date system, ISO 8601. In these systems, the year 0 is a leap year.




    Note that this has nothing to do with the AD/BC versus CE/BCE terminology: those names are only used for referring to which era of years is being used, not the calendar in use.






    share|improve this answer


















    • 1




      Good to know they know about their limitations. Nice find.
      – Alain Cruz
      4 hours ago














    up vote
    6
    down vote



    accepted










    From the LocalDate Javadoc:




    It is equivalent to the proleptic Gregorian calendar system, in which today's rules for leap years are applied for all time. For most applications written today, the ISO-8601 rules are entirely suitable. However, any application that makes use of historical dates, and requires them to be accurate will find the ISO-8601 approach unsuitable.




    Wikipedia has more information on the proleptic Gregorian calendar. Among other things, it says:




    Mathematically, it is more convenient to include a year 0 and represent earlier years as negative, for the specific purpose of facilitating the calculation of the number of years between a negative (BC) year and a positive (AD) year. This is the convention used in astronomical year numbering and in the international standard date system, ISO 8601. In these systems, the year 0 is a leap year.




    Note that this has nothing to do with the AD/BC versus CE/BCE terminology: those names are only used for referring to which era of years is being used, not the calendar in use.






    share|improve this answer


















    • 1




      Good to know they know about their limitations. Nice find.
      – Alain Cruz
      4 hours ago












    up vote
    6
    down vote



    accepted







    up vote
    6
    down vote



    accepted






    From the LocalDate Javadoc:




    It is equivalent to the proleptic Gregorian calendar system, in which today's rules for leap years are applied for all time. For most applications written today, the ISO-8601 rules are entirely suitable. However, any application that makes use of historical dates, and requires them to be accurate will find the ISO-8601 approach unsuitable.




    Wikipedia has more information on the proleptic Gregorian calendar. Among other things, it says:




    Mathematically, it is more convenient to include a year 0 and represent earlier years as negative, for the specific purpose of facilitating the calculation of the number of years between a negative (BC) year and a positive (AD) year. This is the convention used in astronomical year numbering and in the international standard date system, ISO 8601. In these systems, the year 0 is a leap year.




    Note that this has nothing to do with the AD/BC versus CE/BCE terminology: those names are only used for referring to which era of years is being used, not the calendar in use.






    share|improve this answer














    From the LocalDate Javadoc:




    It is equivalent to the proleptic Gregorian calendar system, in which today's rules for leap years are applied for all time. For most applications written today, the ISO-8601 rules are entirely suitable. However, any application that makes use of historical dates, and requires them to be accurate will find the ISO-8601 approach unsuitable.




    Wikipedia has more information on the proleptic Gregorian calendar. Among other things, it says:




    Mathematically, it is more convenient to include a year 0 and represent earlier years as negative, for the specific purpose of facilitating the calculation of the number of years between a negative (BC) year and a positive (AD) year. This is the convention used in astronomical year numbering and in the international standard date system, ISO 8601. In these systems, the year 0 is a leap year.




    Note that this has nothing to do with the AD/BC versus CE/BCE terminology: those names are only used for referring to which era of years is being used, not the calendar in use.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 4 hours ago

























    answered 4 hours ago









    Daniel Pryden

    43.4k769115




    43.4k769115







    • 1




      Good to know they know about their limitations. Nice find.
      – Alain Cruz
      4 hours ago












    • 1




      Good to know they know about their limitations. Nice find.
      – Alain Cruz
      4 hours ago







    1




    1




    Good to know they know about their limitations. Nice find.
    – Alain Cruz
    4 hours ago




    Good to know they know about their limitations. Nice find.
    – Alain Cruz
    4 hours ago












    up vote
    4
    down vote













    From Wikipedia:




    ...there is a year zero in astronomical year numbering (where it coincides with the Julian year 1 BC) and in ISO 8601:2004 (where it coincides with the Gregorian year 1 BC)







    share|improve this answer


























      up vote
      4
      down vote













      From Wikipedia:




      ...there is a year zero in astronomical year numbering (where it coincides with the Julian year 1 BC) and in ISO 8601:2004 (where it coincides with the Gregorian year 1 BC)







      share|improve this answer
























        up vote
        4
        down vote










        up vote
        4
        down vote









        From Wikipedia:




        ...there is a year zero in astronomical year numbering (where it coincides with the Julian year 1 BC) and in ISO 8601:2004 (where it coincides with the Gregorian year 1 BC)







        share|improve this answer














        From Wikipedia:




        ...there is a year zero in astronomical year numbering (where it coincides with the Julian year 1 BC) and in ISO 8601:2004 (where it coincides with the Gregorian year 1 BC)








        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 4 hours ago

























        answered 5 hours ago









        Alex Taylor

        5,14621532




        5,14621532



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52921032%2fjava-says-the-year-0-is-a-leap-year-but-year-0-never-existed%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            Long meetings (6-7 hours a day): Being “babysat” by supervisor

            Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

            Confectionery