Running:
require 'date'
y = Date.new
puts "default year is #{y.year}"
Output:
default year is -4712
Is there any particular reason why the year of a Date object defaults to -4712? I thought perhaps there's a technical (or conventional) reason. I have googled this and looked it up on the Ruby documentation (2.2.3) and I can't see an answer as to why.
The day of January 1, 4713 BC is the beginning of the Julian day, from Wiki:
The Julian Day Number (JDN) is the integer assigned to a whole solar day in the Julian day count starting from noon Greenwich Mean Time, with Julian day number 0 assigned to the day starting at noon on January 1, 4713 BC, proleptic Julian calendar (November 24, 4714 BC, in the proleptic Gregorian calendar), a date at which three multi-year cycles started and which preceded any historical dates. For example, the Julian day number for the day starting at 12:00 UT on January 1, 2000, was 2,451,545.
The year of this day, is 4713 BC, or technically -4712
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With