<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://bsd.neuroinf.jp/w/index.php?action=history&amp;feed=atom&amp;title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB%3ACalendar</id>
	<title>モジュール:Calendar - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://bsd.neuroinf.jp/w/index.php?action=history&amp;feed=atom&amp;title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB%3ACalendar"/>
	<link rel="alternate" type="text/html" href="https://bsd.neuroinf.jp/w/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:Calendar&amp;action=history"/>
	<updated>2026-05-02T05:34:48Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://bsd.neuroinf.jp/w/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:Calendar&amp;diff=43579&amp;oldid=prev</id>
		<title>Nijcadmin: 1版 をインポートしました</title>
		<link rel="alternate" type="text/html" href="https://bsd.neuroinf.jp/w/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:Calendar&amp;diff=43579&amp;oldid=prev"/>
		<updated>2020-01-29T04:27:36Z</updated>

		<summary type="html">&lt;p&gt;1版 をインポートしました&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ja&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2020年1月29日 (水) 13:27時点における版&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ja&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(相違点なし)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Nijcadmin</name></author>
	</entry>
	<entry>
		<id>https://bsd.neuroinf.jp/w/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:Calendar&amp;diff=43578&amp;oldid=prev</id>
		<title>bsd&gt;4nn1l2: Changed protection level for &quot;Module:Calendar&quot;: downgraded protection level per consensus ([Move=Allow only template editors and administrators] (indefinite) [Edit=Allow only template editors and administrators] (ind…</title>
		<link rel="alternate" type="text/html" href="https://bsd.neuroinf.jp/w/index.php?title=%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:Calendar&amp;diff=43578&amp;oldid=prev"/>
		<updated>2019-07-16T11:16:54Z</updated>

		<summary type="html">&lt;p&gt;Changed protection level for &amp;quot;&lt;a href=&quot;/wiki/%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB:Calendar&quot; title=&quot;モジュール:Calendar&quot;&gt;Module:Calendar&lt;/a&gt;&amp;quot;: downgraded protection level per &lt;a href=&quot;/wiki/%E7%89%B9%E5%88%A5:%E5%9B%BA%E5%AE%9A%E3%83%AA%E3%83%B3%E3%82%AF/357548402&quot; title=&quot;特別:固定リンク/357548402&quot;&gt;consensus&lt;/a&gt; ([Move=Allow only template editors and administrators] (indefinite) [Edit=Allow only template editors and administrators] (ind…&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--[[&lt;br /&gt;
  __  __           _       _         ____      _                _            &lt;br /&gt;
 |  \/  | ___   __| |_   _| | ___ _ / ___|__ _| | ___ _ __   __| | __ _ _ __ &lt;br /&gt;
 | |\/| |/ _ \ / _` | | | | |/ _ (_) |   / _` | |/ _ \ &amp;#039;_ \ / _` |/ _` | &amp;#039;__|&lt;br /&gt;
 | |  | | (_) | (_| | |_| | |  __/_| |__| (_| | |  __/ | | | (_| | (_| | |   &lt;br /&gt;
 |_|  |_|\___/ \__,_|\__,_|_|\___(_)\____\__,_|_|\___|_| |_|\__,_|\__,_|_|   &lt;br /&gt;
                                                                             &lt;br /&gt;
Maintainers:&lt;br /&gt;
* Jarekt&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- Convert &amp;quot;Julian day number&amp;quot; (jdn) to a calendar date&lt;br /&gt;
-- &amp;quot;gregorian&amp;quot; is a 1 for gregorian calendar and 0 for Julian&lt;br /&gt;
-- based on https://en.wikipedia.org/wiki/Julian_day#Converting_Julian_or_Gregorian_calendar_date_to_Julian_day_number&lt;br /&gt;
function p._jdn2date(jdn, gregorian)&lt;br /&gt;
  local f, e, g, h, year, month, day&lt;br /&gt;
&lt;br /&gt;
	f = jdn + 1401&lt;br /&gt;
	if gregorian&amp;gt;0 then&lt;br /&gt;
		 f = f + math.floor((math.floor((4*jdn + 274277) / 146097) * 3) / 4) - 38&lt;br /&gt;
	end&lt;br /&gt;
	e = 4*f + 3&lt;br /&gt;
	g = math.floor(math.fmod(e, 1461) / 4)&lt;br /&gt;
	h = 5*g + 2&lt;br /&gt;
	day   = math.floor(math.fmod (h,153) / 5) + 1&lt;br /&gt;
	month = math.fmod (math.floor(h/153) + 2, 12) + 1&lt;br /&gt;
	year  = math.floor(e/1461) - 4716 + math.floor((14 - month) / 12)&lt;br /&gt;
	&lt;br /&gt;
	-- If year is less than 1, subtract one to convert from a zero based date system to the&lt;br /&gt;
	-- common era system in which the year -1 (1 B.C.E) is followed by year 1 (1 C.E.).&lt;br /&gt;
	if year &amp;lt; 1 then&lt;br /&gt;
			year = year - 1&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return string.format(&amp;#039;%04i-%02i-%02i&amp;#039;, year, month, day)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Convert calendar date to  &amp;quot;Julian day number&amp;quot; (jdn) &lt;br /&gt;
-- &amp;quot;gregorian&amp;quot; is a 1 for gregorian calendar and 0 for Julian&lt;br /&gt;
-- based on  https://en.wikipedia.org/wiki/Julian_day#Converting_Julian_or_Gregorian_calendar_date_to_Julian_day_number&lt;br /&gt;
-- explanation based on http://www.cs.utsa.edu/~cs1063/projects/Spring2011/Project1/project1.html&lt;br /&gt;
function p._date2jdn(ISOdate, gregorian)&lt;br /&gt;
  &lt;br /&gt;
	local year, month, day = ISOdate:match( &amp;quot;(-?%d%d%d%d)-(%d%d)-(%d%d)&amp;quot; )&lt;br /&gt;
	if not year then&lt;br /&gt;
		return nil&lt;br /&gt;
	elseif tonumber(year) &amp;lt; 0 then&lt;br /&gt;
		-- If year is less than 0, add one to convert from  the common era system in which&lt;br /&gt;
	    -- the year -1 (1 B.C.E) is followed by year 1 (1 C.E.) to a zero based date system&lt;br /&gt;
		year = year + 1&lt;br /&gt;
	end&lt;br /&gt;
	local a, b, c, d, y, m&lt;br /&gt;
	a = math.floor((14-month) / 12) -- will be 1 for January and February, and 0 for other months.&lt;br /&gt;
	y = year + 4800 - a             -- years since year –4800&lt;br /&gt;
	m = month + 12*a - 3            -- month number where 10 for January, 11 for February, 0 for March, 1 for April&lt;br /&gt;
	c = math.floor((153*m + 2)/5)   -- number of days since March 1&lt;br /&gt;
	if gregorian&amp;gt;0 then	&lt;br /&gt;
		b = math.floor(y/4) - math.floor(y/100) + math.floor(y/400) -- number of leap years since y==0 (year –4800)&lt;br /&gt;
		d = 32045                     -- offset so the result will be 0 for January 1, 4713 BCE&lt;br /&gt;
	else&lt;br /&gt;
		b = math.floor(y/4)           -- number of leap years since y==0 (year –4800)&lt;br /&gt;
		d = 32083                     -- offset so the result will be 0 for January 1, 4713 BCE&lt;br /&gt;
	end&lt;br /&gt;
	return day + c + 365*y + b - d&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Convert a date from Gregorian to Julian calendar&lt;br /&gt;
function p.Gregorian2Julian(frame)&lt;br /&gt;
	local JDN = p._date2jdn(frame.args[1], 1)&lt;br /&gt;
	if JDN then&lt;br /&gt;
		return p._jdn2date(JDN, 0)&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;quot;Error parsing input date: &amp;quot; .. frame.args[1]&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Convert a date from Julian to Gregorian calendar&lt;br /&gt;
function p.Julian2Gregorian(frame)&lt;br /&gt;
	local JDN = p._date2jdn(frame.args[1], 0)&lt;br /&gt;
	if JDN then&lt;br /&gt;
		return p._jdn2date(JDN, 1)&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;quot;Error parsing input date: &amp;quot; .. frame.args[1]&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Return day of week based on gregorian date. Mon-&amp;gt;1, Tue-&amp;gt;2, ..., Sun-&amp;gt;7&lt;br /&gt;
function p.DayOfWeek(frame)&lt;br /&gt;
	local JDN = p._date2jdn(frame.args[1], 1)&lt;br /&gt;
	local day = math.fmod(JDN, 7) + 1&lt;br /&gt;
	if day then&lt;br /&gt;
		local LUT = { &amp;quot;Monday&amp;quot;, &amp;quot;Tuesday&amp;quot;, &amp;quot;Wednesday&amp;quot;, &amp;quot;Thursday&amp;quot;, &amp;quot;Friday&amp;quot;, &amp;quot;Saturday&amp;quot;, &amp;quot;Sunday&amp;quot; }&lt;br /&gt;
		return LUT[day]&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;quot;Error parsing input date: &amp;quot; .. frame.args[1]&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Convert calendar date to  &amp;quot;Julian day number&amp;quot; (jdn)&lt;br /&gt;
function p.date2jdn(frame)&lt;br /&gt;
	return p._date2jdn(frame.args[1] or os.date(&amp;#039;%F&amp;#039;), frame.args[2] or 1)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>bsd&gt;4nn1l2</name></author>
	</entry>
</feed>