Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Template:JULIANDAY

Permanently protected template
From Wikipedia, the free encyclopedia
Template documentation[view] [edit] [history] [purge]

This template computes the number of theJulian day starting at noon on the date given in parameter (in theGregorian calendar, without any Julian correction forproleptic Gregorian dates where the calendar was not effectively applied).

The result is valid for all proleptic Gregorian calendar dates starting on March 1, 4800 BC (−4799) at midnight.

Syntax

{{JULIANDAY|year|[month]|[day]|[hour]|[minute]|[second]}}
  • Theyear (required) must be astronomical (year=1 in1 AD (Anno Domini),year=0 in 1 BC,year=-1 in 2 BC).
  • Themonth (optional, default value 1) is expressed between 1 and 12 from January to December (but offsets are possible for computing other years).
  • Theyear andmonth are first converted into a number of months, then rounded to the nearest integer to compute the actual year and month used for computing dates.
  • Theday (optional, default value 1) is normally between 1 and 31 (but offsets are possible for computing other months). Decimals are possible for fractions of day.
  • Thehour (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.
  • Theminute andsecond (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.
  • All parameters can be any valid numeric expression which is evaluated before computing.

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.

Limitations

Before March 4800 BC, the results may be offseted (by up to 365 or 366 days) due to the limitation of the MediaWiki#expr operators used in the implementation.

This limitation could be fixed (and the implementation simplified a bit) by usinga -floor(a /b ) *b (now supported in expressions) or the more recentafmodb, instead ofamodb already too limited in value range (and actually not used in this template), and instead ofa - (a /b + 0.5round 0) +b, as both are truncating their result towards zero, the equivalent of aceil() when their parameter is negative.

This template was written and optimized to avoid all conditional expressions and to reduce the template expansions to their strict minimum (avoiding also the inclusion of complex templates for computing cyclic modulos, or euclidian divisions and roundings towards minus infinity), because#expr still does not support temporary local variables to store the template parameters and reuse their current value without more expansions.

All problematic negative values are normally avoided by avoiding excessively negative parameter values (using negative values is safe for the day, hour, minute and second parameters, but not safe for the month and year parameters if their resulting month falls before March 4800 BC).

Examples

  • {{JULIANDAY|-4800|2|29|23|59|59}} returns -32044.500011574 (proleptic) (inyear 4801 BC), the result is still correct
  • {{JULIANDAY|-4800|3|1|0|0|0}} returns -32410.5 (proleptic) (inyear 4801 BC), date where the result isfalse (the returned JD is too large by 365 days)
  • {{JULIANDAY|-4799|2|29|23|59|59}} returns -31679.500011574 (proleptic) (inyear 4800 BC), the result is still correct
  • {{JULIANDAY|-4799|3|1|0|0|0}} returns -31679.5 (proleptic) (inyear 4800 BC), first Gregorian date where the result iswarrantied to be correct
  • {{JULIANDAY|-4799|3|1}} returns -31679 (proleptic) (inyear 4800 BC), same date at noon
  • {{JULIANDAY|-4799|3|2}} returns -31678 (proleptic) (inyear 4800 BC), tests the 1 day increment
  • {{JULIANDAY|-4713|11|24}} returns 0 (proleptic) (inyear 4714 BC)
  • {{JULIANDAY|-4713|11|25}} returns 1 (proleptic) (inyear 4714 BC)
  • {{JULIANDAY|0|1|1}} returns 1721060 (proleptic) (inyear 1 BC)
  • {{JULIANDAY|0|12|25}} returns 1721419 (proleptic)
  • {{JULIANDAY|0|12|30}} returns 1721424 (proleptic) (JulianAnno Domini, first day in proleptic Julian year 1 AD, or December 30 in proleptic Gregorian year 1 BC)
  • {{JULIANDAY|0|12|31}} returns 1721425 (proleptic)
  • {{JULIANDAY|1|1|1}} returns 1721426 (proleptic) (GregorianAnno Domini, in proleptic Gregorian year 1 AD, or January 3 in proleptic Julian year 1 AD)
  • {{JULIANDAY|200|2|28}} returns 1794167 (proleptic) (last day of Julian leap year 200 AD, not leap in the proleptic Gregorian calendar)
  • {{JULIANDAY|200|3|1}} returns 1794168 (proleptic) (first day where the Julian and proleptic Gregorian calendars areequivalent)
  • {{JULIANDAY|300|2|28}} returns 1830691 (proleptic) (last day where the Julian and proleptic Gregorian calendars areequivalent)
  • {{JULIANDAY|300|3|1}} returns 1830692 (proleptic) (first day of difference between the Julian and proleptic Gregorian calendars, in leap Julian year 300 AD, not leap in the proleptic Gregorian calendar)
  • {{JULIANDAY|325|3|21}} returns 1839843 (proleptic) (spring equinox observed at the ChristianFirst Council of Nicaea, taken as a reference for aligning the Julian calendar to the proleptic Gregorian)
  • {{JULIANDAY|1582|10|14}} returns 2299160 (proleptic) (last proleptic Gregorian day, actually the 4th of October in the Julian calendar)
  • {{JULIANDAY|1582|10|15}} returns 2299161 (first non proleptic Gregorian day, equals the 5th of October in the previous Julian calendar)
  • {{JULIANDAY|1858|11|16|12|00|00}} returns 2400000 (start of epoch for theReduced Julian Day, RJD)
  • {{JULIANDAY|1858|11|17|00|00|00}} returns 2400000.5 (start of epoch for theModified Julian Day, MJD)
  • {{JULIANDAY|1968|05|24|00|00|00}} returns 2440000.5 (start of epoch for theNASA'sTruncated Julian Day, TJD)
  • {{JULIANDAY|1900|2|28}} returns 2415079
  • {{JULIANDAY|1900|3|1}} returns 2415080
  • {{JULIANDAY|1995|10|10|00|00|00}} returns 2450000.5 (start of epoch for the lastNIST'sTruncated Julian Day, TJD mod 10000)
  • {{JULIANDAY|1999|12|31}} returns 2451544
  • {{JULIANDAY|2000|1|1}} returns 2451545 (the “Y2K bug's day” and millennium celebrations)
  • {{JULIANDAY|2000|2|29}} returns 2451604
  • {{JULIANDAY|2000|3|1}} returns 2451605
  • {{JULIANDAY|2000|12|31}} returns 2451910 (last day of the2nd millennium and of the20th century in the Gregorian calendar)
  • {{JULIANDAY|2001|1|1}} returns 2451911 (first day of the3rd millennium and of the21st century in the Gregorian calendar)
  • {{JULIANDAY|2023|02|25|00|00|00}} returns 2460000.5 (start of epoch for the currentNIST'sTruncated Julian Day, TJD mod 10000)
  • {{JULIANDAY|2025|4|30|0|0|0}} returns 2460795.5
  • {{JULIANDAY|2025|4|30|01|35|48}} returns 2460795.5665278
  • {{JULIANDAY|2025|4|30|11|59|60}} returns 2460796
  • {{JULIANDAY|2025|4|30|12.0}} returns 2460796
  • {{JULIANDAY|2025|4|30}} returns 2460796
  • {{JULIANDAY|2025|4|30|23|59|59}} returns 2460796.4999884
  • {{JULIANDAY|2025|5|1|00|00|00}} returns 2460796.5
  • {{JULIANDAY|2025|5|1|12|00|00}} returns 2460797
  • {{JULIANDAY|2025|5|1}} returns 2460797
  • {{JULIANDAY|2132|8|31}} returns 2500000
  • {{JULIANDAY|3501|8|15}} returns 3000000
  • {{JULIANDAY|5287|11|24}} returns 3652425 (10000 years lapse)
  • {{JULIANDAY|10000|1|1}} returns 5373485
  • {{JULIANDAY|26976|8|20|13|46|40}} returns 11574074.074074 (one trillion seconds lapse)
  • {{JULIANDAY|275760|9|13}} returns 102440588 (maximum date of JavaScript; 100 million days lapse from Unix)

See also

For themagic words with the same or similar names, seeMediaWikiWiki:Help:Magic words § Date and time.

Multiple units of time

TypeAdjustableCurrentLastNext
Date and time{{time}}{{Currentdate}} (MDY)
{{Plain now}} (DMY)
{{Now}} (DMY in a complete sentence)
{{Simple now}}
Date only{{Dateonly}}
{{Datedow}}
(Has the day of the week)
{{Date}} (Chose format)
{{DATE}} (prefixed by date=)
{{TODAY}} (DMY)
{{Yesterday}}
{{Day-1}}
{{Tomorrow}}
{{Day+1}}
Month and year only{{Monthyear}}{{Monthyear-1}}{{Monthyear+1}}
Time only{{Timeonly}}{{CURRENTTIME}} (12 h format)
{{CURRENTTIME24}} (24 h format)
Banners{{Right now}}
(Blue with time and number of Wikipedia articles)
Timestamp{{Timestamp}}
(Format YYYYMMDDhhmmss)

Single units of time

Unit of timeAdjustableCurrentLastNext
Second{{CURRENTSECOND}}
Minute{{CURRENTMINUTE}}
Hour{{CURRENTHOUR}}
Week{{CURRENTWEEK}}
{{CURRENTWEEKOFMONTH}}
Day of Week{{DAYOFWEEK}}{{CURRENTDAYNAME}}
{{CURRENTWEEKDAYABBREV}}
{{CURRENTWEEKDAY}}
Month{{MONTHNAME}}
{{MONTHABBREV}}
{{MONTHNUMBER}}
{{MONTH}} (zero padded)
{{CURRENTMONTHNAME}}
{{CURRENTMONTHABBREV}}
{{CURRENTMONTH1}}
{{CURRENTMONTHDAYS}}
{{LASTMONTHNAME}}{{NEXTMONTHNAME}}
Day of Month{{CURRENTDAY}}
{{CURRENTDAY2}} (zero padded)
Year{{CURRENTYEARCC}}
{{CURRENTYEARYY}}
{{CURRENTISOYEAR}}
{{CURRENTYEAR}}
{{LASTYEAR}}{{NEXTYEAR}}
Day of Year{{CURRENTDAYOFYEAR}}
Decade{{DECADE}}{{CURRENTDECADE}}
Century{{Century}}{{CURRENTCENTURY}}
MILLENNIUM{{MILLENNIUM}}

Date and time templates made for substitution:

Month:
{{Lmonth}} produces Mar
{{Nmonth}} produces May
{{Last month}} produces March 2025
{{Next month}} produces May 2025


Parser functions

Individual templates

Categories of templates

The abovedocumentation istranscluded fromTemplate:JULIANDAY/doc.(edit |history)
Editors can experiment in this template'ssandbox(edit |diff) andtestcases(edit) pages.
Add categories to the/doc subpage.Subpages of this template.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Template:JULIANDAY&oldid=1063310610"
Category:
Hidden category:

[8]ページ先頭

©2009-2025 Movatter.jp