Template:JULIANDAY.YEAR

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Template documentation[view] [edit] [history] [purge]

This template takes a julian day number and returns the associated year number within the Gregorian calendar.

Computing formula (partially indented)[change source]

For more information about how this formula works, see Julian day.
{{#expr:
   (   (({{{1}}})+32044 round 0)     / 146097         + 0.5 round 0)                      * 400
+
  ((   (({{{1}}})+32044 round 0)   mod 146097 / 36524 + 0.5 round 0) * 3/4 + 0.5 round 0) * 100
+
  ((   (({{{1}}})+32044 round 0)   mod 146097 + 36524 -
  ((   (({{{1}}})+32044 round 0)   mod 146097 / 36524 + 0.5 round 0) * 3/4 + 0.5 round 0) * 36524
   )  /  1461       + 0.5 round 0) * 4
+
 (((   (({{{1}}})+32044 round 0)   mod 146097 + 36524 -
  ((   (({{{1}}})+32044 round 0)   mod 146097 / 36524 + 0.5 round 0) * 3/4 + 0.5 round 0) * 36524
   ) mod 1461 / 365 + 0.5 round 0) * 3 / 4 + 0.5 round 0)
+
((((   (({{{1}}})+32044 round 0)   mod 146097 + 36524 -
  ((   (({{{1}}})+32044 round 0)   mod 146097 / 36524 + 0.5 round 0) * 3/4 + 0.5 round 0) * 36524
   ) mod 1461
-
 (((   (({{{1}}})+32044 round 0)   mod 146097 + 36524 -
  ((   (({{{1}}})+32044 round 0)   mod 146097 / 36524 + 0.5 round 0) * 3/4 + 0.5 round 0) * 36524
   ) mod 1461 / 365 + 0.5 round 0) * 3 / 4 + 0.5 round 0) * 365 + 365) * 5 + 308) / 153 - 0.5 round 0)
 / 12
- 5305.5
round 0}}
  • The actual formula in the template drops all whitespaces shown here, as well as the "0" in "0.5".
  • The constant 146097 is the number of days in 400 years (Gregorian calendar)
  • The constant 36524 is the number of days in 100 years (Gregorian calendar)
  • The constant 1461 is the number of days in 4 years (Gregorian calendar)
  • The constant 308 adjusts the number of days in a year since last March 1 (possibly from the previous year)
  • The constant 153 is the number of days every 5 months (in the same year starting on March 1) excepting the addition of 1 day on July 31 and December 31.

Examples with a non-leap secular year (of rank 3) [change source]

  • {{JULIANDAY.YEAR|{{JULIANDAY|1900| 1| 1}}}} = "1900".
  • {{JULIANDAY.YEAR|{{JULIANDAY|1900| 1|31}}}} = "1900".
  • {{JULIANDAY.YEAR|{{JULIANDAY|1900| 2| 1}}}} = "1900".
  • {{JULIANDAY.YEAR|{{JULIANDAY|1900| 2|28}}}} = "1900".
  • {{JULIANDAY.YEAR|{{JULIANDAY|1900| 3| 1}}}} = "1900".
  • {{JULIANDAY.YEAR|{{JULIANDAY|1900| 3|31}}}} = "1900".
  • {{JULIANDAY.YEAR|{{JULIANDAY|1900| 4| 1}}}} = "1900".
  • {{JULIANDAY.YEAR|{{JULIANDAY|1900| 4|30}}}} = "1900".
  • {{JULIANDAY.YEAR|{{JULIANDAY|1900| 5| 1}}}} = "1900".
  • {{JULIANDAY.YEAR|{{JULIANDAY|1900| 5|31}}}} = "1900".
  • {{JULIANDAY.YEAR|{{JULIANDAY|1900| 6| 1}}}} = "1900".
  • {{JULIANDAY.YEAR|{{JULIANDAY|1900| 6|30}}}} = "1900".
  • {{JULIANDAY.YEAR|{{JULIANDAY|1900| 7| 1}}}} = "1900".
  • {{JULIANDAY.YEAR|{{JULIANDAY|1900| 7|31}}}} = "1900".
  • {{JULIANDAY.YEAR|{{JULIANDAY|1900| 8| 1}}}} = "1900".
  • {{JULIANDAY.YEAR|{{JULIANDAY|1900| 8|31}}}} = "1900".
  • {{JULIANDAY.YEAR|{{JULIANDAY|1900| 9| 1}}}} = "1900".
  • {{JULIANDAY.YEAR|{{JULIANDAY|1900| 9|30}}}} = "1900".
  • {{JULIANDAY.YEAR|{{JULIANDAY|1900|10| 1}}}} = "1900".
  • {{JULIANDAY.YEAR|{{JULIANDAY|1900|10|31}}}} = "1900".
  • {{JULIANDAY.YEAR|{{JULIANDAY|1900|11| 1}}}} = "1900".
  • {{JULIANDAY.YEAR|{{JULIANDAY|1900|11|30}}}} = "1900".
  • {{JULIANDAY.YEAR|{{JULIANDAY|1900|12| 1}}}} = "1900".
  • {{JULIANDAY.YEAR|{{JULIANDAY|1900|12|31}}}} = "1900".

Examples with a leap secular year (of rank 4) [change source]

  • {{JULIANDAY.YEAR|{{JULIANDAY|2000| 1| 1}}}} = "2000".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2000| 1|31}}}} = "2000".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2000| 2| 1}}}} = "2000".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2000| 2|29}}}} = "2000".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2000| 3| 1}}}} = "2000".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2000| 3|31}}}} = "2000".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2000| 4| 1}}}} = "2000".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2000| 4|30}}}} = "2000".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2000| 5| 1}}}} = "2000".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2000| 5|31}}}} = "2000".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2000| 6| 1}}}} = "2000".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2000| 6|30}}}} = "2000".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2000| 7| 1}}}} = "2000".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2000| 7|31}}}} = "2000".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2000| 8| 1}}}} = "2000".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2000| 8|31}}}} = "2000".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2000| 9| 1}}}} = "2000".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2000| 9|30}}}} = "2000".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2000|10| 1}}}} = "2000".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2000|10|31}}}} = "2000".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2000|11| 1}}}} = "2000".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2000|11|30}}}} = "2000".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2000|12| 1}}}} = "2000".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2000|12|31}}}} = "2000".

Examples with a non-leap non-secular year (of rank 1) [change source]

  • {{JULIANDAY.YEAR|{{JULIANDAY|2001| 1| 1}}}} = "2001".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2001| 1|31}}}} = "2001".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2001| 2| 1}}}} = "2001".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2001| 2|28}}}} = "2001".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2001| 3| 1}}}} = "2001".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2001| 3|31}}}} = "2001".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2001| 4| 1}}}} = "2001".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2001| 4|30}}}} = "2001".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2001| 5| 1}}}} = "2001".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2001| 5|31}}}} = "2001".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2001| 6| 1}}}} = "2001".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2001| 6|30}}}} = "2001".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2001| 7| 1}}}} = "2001".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2001| 7|31}}}} = "2001".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2001| 8| 1}}}} = "2001".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2001| 8|31}}}} = "2001".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2001| 9| 1}}}} = "2001".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2001| 9|30}}}} = "2001".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2001|10| 1}}}} = "2001".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2001|10|31}}}} = "2001".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2001|11| 1}}}} = "2001".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2001|11|30}}}} = "2001".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2001|12| 1}}}} = "2001".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2001|12|31}}}} = "2001".

Examples with a non-leap non-secular year (of rank 2) [change source]

  • {{JULIANDAY.YEAR|{{JULIANDAY|2002| 1| 1}}}} = "2002".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2002| 1|31}}}} = "2002".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2002| 2| 1}}}} = "2002".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2002| 2|28}}}} = "2002".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2002| 3| 1}}}} = "2002".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2002| 3|31}}}} = "2002".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2002| 4| 1}}}} = "2002".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2002| 4|30}}}} = "2002".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2002| 5| 1}}}} = "2002".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2002| 5|31}}}} = "2002".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2002| 6| 1}}}} = "2002".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2002| 6|30}}}} = "2002".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2002| 7| 1}}}} = "2002".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2002| 7|31}}}} = "2002".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2002| 8| 1}}}} = "2002".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2002| 8|31}}}} = "2002".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2002| 9| 1}}}} = "2002".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2002| 9|30}}}} = "2002".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2002|10| 1}}}} = "2002".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2002|10|31}}}} = "2002".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2002|11| 1}}}} = "2002".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2002|11|30}}}} = "2002".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2002|12| 1}}}} = "2002".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2002|12|31}}}} = "2002".

Examples with a non-leap non-secular year (of rank 3) [change source]

  • {{JULIANDAY.YEAR|{{JULIANDAY|2003| 1| 1}}}} = "2003".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2003| 1|31}}}} = "2003".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2003| 2| 1}}}} = "2003".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2003| 2|28}}}} = "2003".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2003| 3| 1}}}} = "2003".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2003| 3|31}}}} = "2003".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2003| 4| 1}}}} = "2003".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2003| 4|30}}}} = "2003".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2003| 5| 1}}}} = "2003".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2003| 5|31}}}} = "2003".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2003| 6| 1}}}} = "2003".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2003| 6|30}}}} = "2003".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2003| 7| 1}}}} = "2003".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2003| 7|31}}}} = "2003".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2003| 8| 1}}}} = "2003".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2003| 8|31}}}} = "2003".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2003| 9| 1}}}} = "2003".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2003| 9|30}}}} = "2003".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2003|10| 1}}}} = "2003".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2003|10|31}}}} = "2003".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2003|11| 1}}}} = "2003".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2003|11|30}}}} = "2003".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2003|12| 1}}}} = "2003".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2003|12|31}}}} = "2003".

Examples with a leap non-secular year (of rank 4) [change source]

  • {{JULIANDAY.YEAR|{{JULIANDAY|2004| 1| 1}}}} = "2004".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2004| 1|31}}}} = "2004".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2004| 2| 1}}}} = "2004".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2004| 2|29}}}} = "2004".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2004| 3| 1}}}} = "2004".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2004| 3|31}}}} = "2004".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2004| 4| 1}}}} = "2004".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2004| 4|30}}}} = "2004".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2004| 5| 1}}}} = "2004".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2004| 5|31}}}} = "2004".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2004| 6| 1}}}} = "2004".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2004| 6|30}}}} = "2004".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2004| 7| 1}}}} = "2004".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2004| 7|31}}}} = "2004".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2004| 8| 1}}}} = "2004".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2004| 8|31}}}} = "2004".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2004| 9| 1}}}} = "2004".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2004| 9|30}}}} = "2004".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2004|10| 1}}}} = "2004".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2004|10|31}}}} = "2004".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2004|11| 1}}}} = "2004".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2004|11|30}}}} = "2004".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2004|12| 1}}}} = "2004".
  • {{JULIANDAY.YEAR|{{JULIANDAY|2004|12|31}}}} = "2004".

See also [change source]