Template:JULIANDAY: Difference between revisions

From Vigyanwiki
Template>CBDunkerson
(Change default hour to 12)
Template>Verdy p
mNo edit summary
Line 1: Line 1:
<includeonly>{{#if:{{{3|}}}|{{#if:{{{2|}}}|{{#if:{{{1|}}}|{{#expr:(({{{1}}}-((14-{{{2}}})div 12-0.5 round 0)+4800)*1461 div 4-0.5 round 0)-(({{{1}}}-((14-{{{2}}})div 12-0.5 round 0)+4800)div 100-0.5 round 0)+(({{{1}}}-((14-{{{2}}})div 12-0.5 round 0)+4800)div 400-0.5 round 0)+(((((14-{{{2}}})div 12-0.5 round 0)*12+{{{2}}}-3)*153+2)div 5-0.5 round 0)+{{{3}}}-32045 +({{{4|12}}}-12)div 24+{{{5|0}}}div 1440}}|Parameter 1=''year'' required!}}|Parameter 2=''month'' required!}}|Parameter 3=''day'' required!}}</includeonly><noinclude>{{Template documentation}}
<includeonly>{{#if:{{{3|}}}|{{#if:{{{2|}}}|{{#if:{{{1|}}}|{{#expr:(((({{{2}}})+57608.5 round 0)/12+({{{1}}})-1.5 round 0)*1461/4-0.5 round 0)-(((({{{2}}})+57608.5 round 0)/12+({{{1}}})-1.5 round 0)/100-0.5 round 0)+(((({{{2}}})+57608.5 round 0)/12+({{{1}}})-1.5 round 0)/400-0.5 round 0)+(((({{{2}}})+57608.5 round 0)mod 12+4)*153/5-0.5 round 0)+({{{3}}})+({{{4|12}}})/24+({{{5|0}}})/1440+({{{6|0}}})/86400-32167.5}}|Parameter 1=''year'' required!}}|Parameter 2=''month'' required!}}|Parameter 3=''day'' required!}}</includeonly><noinclude>{{Template documentation}}
This template computes the number of the [[Julian day]] starting at noon on the date given in parameter (in the [[gregorian calendar]], without the julian correction for proleptic years).
This template computes the number of the [[Julian day]] starting at noon on the date given in parameter (in the [[Gregorian calendar]], without any Julian correction for proleptic years).


; Syntax<nowiki>:</nowiki>
; Syntax<nowiki>:</nowiki>
: <tt><nowiki>{{</nowiki>JULIANDAY|</tt>''year''<tt>|</tt>''month''<tt>|</tt>''day''<tt>|</tt>''hour''<tt>|</tt>''minute''<tt>}}</tt>
: <tt><nowiki>{{</nowiki>JULIANDAY|</tt>''year''<tt>|</tt>''month''<tt>|</tt>''day''<tt>|</tt>''hour''<tt>|</tt>''minute''<tt>}}</tt>
* The ''year'' must be astronomical (''year''=1 in [[1|1 AD]] (''[[Anno Domini]]''), ''year''=0 in 1 BC, ''year''=-1 in 2 BC).
* The ''year'' (required) must be astronomical (''year''=1 in [[1|1 AD]] (''[[Anno Domini]]''), ''year''=0 in 1 BC, ''year''=-1 in 2 BC). It is rounded to the nearest integer before computing.
* The ''month'' is expressed between 1 et 12 from january to december.
* The ''month'' (required) is expressed between 1 et 12 from january to december (but offsets are possible for computing other years, by converting the value into years and months with a division by 12). It is rounded to the nearest integer before computing.
* The ''day'' is normally between 1 et 31 (but offsets are possible for computing other days).
* The ''day'' (required) is normally between 1 et 31 (but offsets are possible for computing other months). Decimals are possible for fractions of day.
* The ''hour'' is between 0 and 23. Note that Julian days begin at noon (hour = 12) and thus hours 0-11 of a solar day are one Julian day earlier than hours 12-23.
* The ''hour'' (optional, default value 12) is normally between 0 and 23 (but offsets are possible for computing other days). Note that Julian days begin at noon (hour = 12) and thus hours 0-11 of a solar day are one Julian day earlier than hours 12-23. The value may extend outside of the normal range and is considered as additional number of julian days (a Julian day is 24 hours or 86400 seconds exactly, ignoring any adjustment of leap seconds within the UTC calendar). Decimals are possible for fractions of hour.
* The ''minute'' is between 0 and 59.
* The ''minute'' and ''second'' (optional, default value 0) are normally between 0 and 59 (but offsets are possible for computing other hours). Decimals are possible for fractions of minute or second.


; Note<nowiki>:</nowiki>
; Note<nowiki>:</nowiki>

Revision as of 12:14, 30 April 2006

Template:Template documentation This template computes the number of the Julian day starting at noon on the date given in parameter (in the Gregorian calendar, without any Julian correction for proleptic years).

Syntax:
{{JULIANDAY|year|month|day|hour|minute}}
  • The year (required) must be astronomical (year=1 in 1 AD (Anno Domini), year=0 in 1 BC, year=-1 in 2 BC). It is rounded to the nearest integer before computing.
  • The month (required) is expressed between 1 et 12 from january to december (but offsets are possible for computing other years, by converting the value into years and months with a division by 12). It is rounded to the nearest integer before computing.
  • The day (required) is normally between 1 et 31 (but offsets are possible for computing other months). Decimals are possible for fractions of day.
  • The hour (optional, default value 12) is normally between 0 and 23 (but offsets are possible for computing other days). Note that Julian days begin at noon (hour = 12) and thus hours 0-11 of a solar day are one Julian day earlier than hours 12-23. The value may extend outside of the normal range and is considered as additional number of julian days (a Julian day is 24 hours or 86400 seconds exactly, ignoring any adjustment of leap seconds within the UTC calendar). Decimals are possible for fractions of hour.
  • The minute and second (optional, default value 0) are normally between 0 and 59 (but offsets are possible for computing other hours). Decimals are possible for fractions of minute or second.
Note:
The julian day, when computed modulo 7, grows from 0 (on monday at noon) to 6 (on sunday at noon)) and falls back to 0 (on next monday). This corresponds to the order of days in the ISO week.
Examples:
{{JULIANDAY|-4713|11|24}} returns 0 (an 4714 av. J.-C., proleptic)
{{JULIANDAY|0|1|1}} returns 1721060 (an 1 av. J.-C., proleptic)
{{JULIANDAY|0|12|31}} returns 1721425
{{JULIANDAY|1|1|1}} returns 1721426 (Anno Domini, proleptic)
{{JULIANDAY|1752|2|29}} returns 2361024 (last proleptic day)
{{JULIANDAY|1752|3|1}} returns 2361025 (first non proleptic day)
{{JULIANDAY|1999|12|31}} returns 2451544
{{JULIANDAY|2000|1|1}} returns 2451545
{{JULIANDAY|2000|1|2}} returns 2451546
{{JULIANDAY|2000|2|1}} returns 2451576
{{JULIANDAY|2000|3|1}} returns 2451605
{{JULIANDAY|2000|12|31}} returns 2451910
{{JULIANDAY|2001|12|31}} returns 2452275
{{JULIANDAY|2002|12|31}} returns 2452640
{{JULIANDAY|2003|12|31}} returns 2453005
{{JULIANDAY|2006|2|1}} returns 2453768
{{JULIANDAY|2006|3|1}} returns 2453796
{{JULIANDAY|2006|3|31}} returns 2453826
{{JULIANDAY|2006|4|30}} returns 2453856
{{JULIANDAY|2006|4|30|1|27}} returns 2453855.5604167
See also:
Template:YEARCC
Template:YEARYY
Template:CENTURY
Template:ISLEAPYEAR
Template:WEEKDAY
Template:ISOYEAR
Template:CURRENTJULIANDAY