编辑“︁
Template:JULIANDAY/doc
”︁
跳转到导航
跳转到搜索
这是
JULIANDAY
模板的
文档页面
。
警告:
您没有登录。如果您进行任何编辑,您的IP地址会公开展示。如果您
登录
或
创建账号
,您的编辑会以您的用户名署名,此外还有其他益处。
反垃圾检查。
不要
加入这个!
<noinclude>{{Documentation subpage}}{{High-use}}</noinclude> <!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE --> 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 Gregorian calendar|proleptic 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 === : <code><nowiki>{{</nowiki>JULIANDAY|</code>''year''<code>|</code>''[month]''<code>|</code>''[day]''<code>|</code>''[hour]''<code>|</code>''[minute]''<code>|</code>''[second]''<code>}}</code> * The ''year'' (required) must be astronomical (''year''=1 in [[0s|1 AD]] (''[[Anno Domini]]''), ''year''=0 in 1 BC, ''year''=-1 in 2 BC). * The ''month'' (optional, default value 1) is expressed between 1 and 12 from January to December (but offsets are possible for computing other years). * The ''year'' and ''month'' 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. * The ''day'' (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. * 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. * 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 <code>#expr</code> operators used in the implementation. This limitation could be fixed (and the implementation simplified a bit) by using <code>''a'' - '''floor'''(''a'' / ''b'' ) * ''b''</code> (now supported in expressions) or the more recent <code>''a'' '''fmod''' ''b''</code>, instead of <code>''a'' '''mod''' ''b''</code> already too limited in value range (and actually not used in this template), and instead of <code>''a'' - (''a'' / ''b'' + 0.5 '''round''' 0) + ''b''</code>, as both are truncating their result towards zero, the equivalent of a <code>ceil()</code> 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 <code>#expr</code> 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 === * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|-4800|2|29|23|59|59}}</nowiki></code> returns {{{{BASEPAGENAME}}|-4800|2|29|23|59|59}} (''proleptic'') (in ''year 4801 BC''), the result is still correct * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|-4800|3|1|0|0|0}}</nowiki></code> returns {{{{BASEPAGENAME}}|-4800|3|1|0|0|0}} (''proleptic'') (in ''year 4801 BC''), date where the result is '''false''' (the returned JD is too large by 365 days) * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|-4799|2|29|23|59|59}}</nowiki></code> returns {{{{BASEPAGENAME}}|-4799|2|29|23|59|59}} (''proleptic'') (in ''year 4800 BC''), the result is still correct * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|-4799|3|1|0|0|0}}</nowiki></code> returns {{{{BASEPAGENAME}}|-4799|3|1|0|0|0}} (''proleptic'') (in ''year 4800 BC''), first Gregorian date where the result is '''warrantied to be correct''' * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|-4799|3|1}}</nowiki></code> returns {{{{BASEPAGENAME}}|-4799|3|1}} (''proleptic'') (in ''year 4800 BC''), same date at noon * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|-4799|3|2}}</nowiki></code> returns {{{{BASEPAGENAME}}|-4799|3|2}} (''proleptic'') (in ''year 4800 BC''), tests the 1 day increment * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|-4713|11|24}}</nowiki></code> returns {{{{BASEPAGENAME}}|-4713|11|24}} (''proleptic'') (in ''year 4714 BC'') * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|-4713|11|25}}</nowiki></code> returns {{{{BASEPAGENAME}}|-4713|11|25}} (''proleptic'') (in ''year 4714 BC'') * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|0|1|1}}</nowiki></code> returns {{{{BASEPAGENAME}}|0|1|1}} (''proleptic'') (in ''year 1 BC'') * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|0|12|25}}</nowiki></code> returns {{{{BASEPAGENAME}}|0|12|25}} (''proleptic'') * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|0|12|30}}</nowiki></code> returns {{{{BASEPAGENAME}}|0|12|30}} (''proleptic'') (Julian ''[[Anno Domini]]'', first day in proleptic Julian year 1 AD, or December 30 in proleptic Gregorian year 1 BC) * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|0|12|31}}</nowiki></code> returns {{{{BASEPAGENAME}}|0|12|31}} (''proleptic'') * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|1|1|1}}</nowiki></code> returns {{{{BASEPAGENAME}}|1|1|1}} (''proleptic'') (Gregorian ''[[Anno Domini]]'', in proleptic Gregorian year 1 AD, or January 3 in proleptic Julian year 1 AD) * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|200|2|28}}</nowiki></code> returns {{{{BASEPAGENAME}}|200|2|28}} (''proleptic'') (last day of Julian leap year 200 AD, not leap in the proleptic Gregorian calendar) * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|200|3|1}}</nowiki></code> returns {{{{BASEPAGENAME}}|200|3|1}} (''proleptic'') (first day where the Julian and proleptic Gregorian calendars are '''equivalent''') * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|300|2|28}}</nowiki></code> returns {{{{BASEPAGENAME}}|300|2|28}} (''proleptic'') (last day where the Julian and proleptic Gregorian calendars are '''equivalent''') * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|300|3|1}}</nowiki></code> returns {{{{BASEPAGENAME}}|300|3|1}} (''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) * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|325|3|21}}</nowiki></code> returns {{{{BASEPAGENAME}}|325|3|21}} (''proleptic'') (spring equinox observed at the Christian [[First Council of Nicaea]], taken as a reference for aligning the Julian calendar to the proleptic Gregorian) * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|1582|10|14}}</nowiki></code> returns {{{{BASEPAGENAME}}|1582|10|14}} (''proleptic'') (last proleptic Gregorian day, actually the 4th of October in the Julian calendar) * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|1582|10|15}}</nowiki></code> returns {{{{BASEPAGENAME}}|1582|10|15}} (first non proleptic Gregorian day, equals the 5th of October in the previous Julian calendar) * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|1858|11|16|12|00|00}}</nowiki></code> returns {{{{BASEPAGENAME}}|1858|11|16|12|00|00}} (start of epoch for the [[Julian day#Alternatives|Reduced Julian Day]], RJD) * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|1858|11|17|00|00|00}}</nowiki></code> returns {{{{BASEPAGENAME}}|1858|11|17|00|00|00}} (start of epoch for the [[Julian day#Alternatives|Modified Julian Day]], MJD) * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|1968|05|24|00|00|00}}</nowiki></code> returns {{{{BASEPAGENAME}}|1968|05|24|00|00|00}} (start of epoch for the [[NASA]]'s [[Julian day#Alternatives|Truncated Julian Day]], TJD) * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|1900|2|28}}</nowiki></code> returns {{{{BASEPAGENAME}}|1900|2|28}} * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|1900|3|1}}</nowiki></code> returns {{{{BASEPAGENAME}}|1900|3|1}} * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|1995|10|10|00|00|00}}</nowiki></code> returns {{{{BASEPAGENAME}}|1995|10|10|00|00|00}} (start of epoch for the last [[National Institute of Standards and Technology|NIST]]'s [[Julian day#Alternatives|Truncated Julian Day]], TJD mod 10000) * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|1999|12|31}}</nowiki></code> returns {{{{BASEPAGENAME}}|1999|12|31}} * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|2000|1|1}}</nowiki></code> returns {{{{BASEPAGENAME}}|2000|1|1}} (the “[[Year 2000 problem|Y2K bug]]'s day” and millennium celebrations) * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|2000|2|29}}</nowiki></code> returns {{{{BASEPAGENAME}}|2000|2|29}} * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|2000|3|1}}</nowiki></code> returns {{{{BASEPAGENAME}}|2000|3|1}} * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|2000|12|31}}</nowiki></code> returns {{{{BASEPAGENAME}}|2000|12|31}} (last day of the [[2nd millennium]] and of the [[w:20th century|20th century]] in the Gregorian calendar) * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|2001|1|1}}</nowiki></code> returns {{{{BASEPAGENAME}}|2001|1|1}} (first day of the [[3rd millennium]] and of the [[w:21st century|21st century]] in the Gregorian calendar) * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|2023|02|25|00|00|00}}</nowiki></code> returns {{{{BASEPAGENAME}}|2023|02|25|00|00|00}} (start of epoch for the current [[National Institute of Standards and Technology|NIST]]'s [[Julian day#Alternatives|Truncated Julian Day]], TJD mod 10000) * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|{{CURRENTYEAR}}<nowiki>|4|30|0|0|0}}</nowiki></code> returns {{{{BASEPAGENAME}}|{{CURRENTYEAR}}|4|30|0|0|0}} * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|{{CURRENTYEAR}}<nowiki>|4|30|01|35|48}}</nowiki></code> returns {{{{BASEPAGENAME}}|{{CURRENTYEAR}}|4|30|01|35|48}} * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|{{CURRENTYEAR}}<nowiki>|4|30|11|59|60}}</nowiki></code> returns {{{{BASEPAGENAME}}|{{CURRENTYEAR}}|4|30|11|59|60}} * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|{{CURRENTYEAR}}<nowiki>|4|30|12.0}}</nowiki></code> returns {{{{BASEPAGENAME}}|{{CURRENTYEAR}}|4|30|12.0}} * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|{{CURRENTYEAR}}<nowiki>|4|30}}</nowiki></code> returns {{{{BASEPAGENAME}}|{{CURRENTYEAR}}|4|30}} * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|{{CURRENTYEAR}}<nowiki>|4|30|23|59|59}}</nowiki></code> returns {{{{BASEPAGENAME}}|{{CURRENTYEAR}}|4|30|23|59|59}} * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|{{CURRENTYEAR}}<nowiki>|5|1|00|00|00}}</nowiki></code> returns {{{{BASEPAGENAME}}|{{CURRENTYEAR}}|5|1|00|00|00}} * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|{{CURRENTYEAR}}<nowiki>|5|1|12|00|00}}</nowiki></code> returns {{{{BASEPAGENAME}}|{{CURRENTYEAR}}|5|1|12|00|00}} * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}|{{CURRENTYEAR}}<nowiki>|5|1}}</nowiki></code> returns {{{{BASEPAGENAME}}|{{CURRENTYEAR}}|5|1}} * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|2132|8|31}}</nowiki></code> returns {{{{BASEPAGENAME}}|2132|8|31}} * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|3501|8|15}}</nowiki></code> returns {{{{BASEPAGENAME}}|3501|8|15}} * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|5287|11|24}}</nowiki></code> returns {{{{BASEPAGENAME}}|5287|11|24}} (10000 years lapse) * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|10000|1|1}}</nowiki></code> returns {{{{BASEPAGENAME}}|10000|1|1}} * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|26976|8|20|13|46|40}}</nowiki></code> returns {{{{BASEPAGENAME}}|26976|8|20|13|46|40}} (one trillion seconds lapse) * <code><nowiki>{{</nowiki>{{BASEPAGENAME}}<nowiki>|275760|9|13}}</nowiki></code> returns {{{{BASEPAGENAME}}|275760|9|13}} ([[Time formatting and storage bugs#Year 275,760|maximum date of JavaScript]]; 100 million days lapse from Unix) === See also === * [[Template:JULIANDAY.JULIAN]] (version taking a date in the Julian calendar) * [[Template:JD]] (automatic Julian or Gregorian calendar determination) * [[Template:JULIANDAY.YEAR]] (returns the year from a JD, in the Gregorian calendar) * [[Template:JULIANDAY.MONTH]] (returns the month from a JD, in the Gregorian calendar) * [[Template:JULIANDAY.DAY]] (returns the day of month from a JD, in the Gregorian calendar) * [[Template:JULIANDAY.HOUR]] (returns the hour from a JD) * [[Template:JULIANDAY.MINUTE]] (returns the minute from a JD) * [[Template:JULIANDAY.SECOND]] (returns the second from a JD) * [[Template:YEARCC]] * [[Template:YEARYY]] * [[Template:Century]] * [[Template:IsLeapYear]] * [[Template:Weekday]] * [[Template:CURRENTJULIANDAY]] {{Date and time templates}} <includeonly>{{Sandbox other| | <!-- ADD CATEGORIES BELOW THIS LINE: --> [[Category:日期计算模板]] }}</includeonly>
摘要:
请注意,所有对Local Chinese Wikipedia的贡献均可能会被其他贡献者编辑、修改或删除。如果您不希望您的文字作品被随意编辑,请不要在此提交。
您同时也向我们承诺,您提交的内容为您自己所创作,或是复制自公共领域或类似自由来源(详情请见
Project:著作权
)。
未经许可,请勿提交受著作权保护的作品!
取消
编辑帮助
(在新窗口中打开)
导航菜单
个人工具
未登录
讨论
贡献
创建账号
登录
命名空间
模板
讨论
大陆简体
不转换
简体
繁體
大陆简体
香港繁體
澳門繁體
大马简体
新加坡简体
臺灣正體
查看
阅读
编辑
查看历史
更多
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
工具
链入页面
相关更改
特殊页面
页面信息