Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
You must create an account or log in to edit.

Module:Keppel date/doc: Difference between revisions

From Amaranth Legacy, available at amaranth-legacy.community
Content deleted Content added
Replaced content with "__NOTOC__ Converts the current (or provided) date to a Keppel date. Used by Template:Keppel date."
Tags: Replaced 2017 source edit
No edit summary
Tag: 2017 source edit
Line 2: Line 2:
Converts the current (or provided) date to a Keppel date.
Converts the current (or provided) date to a Keppel date.
Used by [[Template:Keppel date]].
Used by [[Template:Keppel date]].

==Formula==
<math mode="display" fleqn>
\begin{aligned}
y_\oplus &= \text{Earth year} \\
d_{\oplus_\text{max}} &= \begin{cases}
366 & y_\oplus = 0 \pmod{4} \text{ and }y_\oplus \neq 0 \pmod{100}\text{ and }y_\oplus \neq 0 \pmod{400} \\
366 & y_\oplus = 0 \pmod{400}\\
365 & \text{otherwise}
\end{cases} \\
d_\oplus &= \text{Earth day of year (fractional)} \\
d_{\text{K}_\text{start}} &= d_{\oplus_\text{max}} - 287 \\ % March 20
y_\text{K} &= \begin{cases}
y_\oplus - 892 & d_\oplus - d_{\text{K}_\text{start}} > 1 \\
y_\oplus - 892 - 1 & d_\oplus - d_{\text{K}_\text{start}} \leq 1
\end{cases} \\
d_{\text{K}_\text{max}} &= \begin{cases}
391 & y_\text{K} = 65 \pmod{239} \text{ and } y_\text{K} = 2 \pmod{4} \\
390 & y_\text{K} = 65 \pmod{239} \\
390 & y_\text{K} = 2 \pmod{4} \\
389 & \text{otherwise}
\end{cases} \\
d_\text{K} &= \begin{cases}
\frac{d_\oplus - d_{\text{K}_\text{start}}}{d_{\oplus_\text{max}}} \times d_{\text{K}_\text{max}} & d_\oplus - d_{\text{K}_\text{start}} > 1 \\
\frac{d_\oplus - d_{\text{K}_\text{start}}}{d_{\oplus_\text{max}}} \times d_{\text{K}_\text{max}} + d_{\text{K}_\text{max}} & d_\oplus - d_{\text{K}_\text{start}} \leq 1
\end{cases} \\
L &= \lfloor \frac{d_\text{K} - 1}{32} \rfloor + 1 \\
d_{\text{K}_\text{L}} &= \lfloor d_\text{K} \rfloor - 32 \times (L - 1)
\end{aligned}
</math>

Revision as of 13:46, March 20, 2026

Converts the current (or provided) date to a Keppel date. Used by Template:Keppel date.

Formula

\begin{aligned} y_\oplus &= \text{Earth year} \\ d_{\oplus_\text{max}} &= \begin{cases} 366 & y_\oplus = 0 \pmod{4} \text{ and }y_\oplus \neq 0 \pmod{100}\text{ and }y_\oplus \neq 0 \pmod{400} \\ 366 & y_\oplus = 0 \pmod{400}\\ 365 & \text{otherwise} \end{cases} \\ d_\oplus &= \text{Earth day of year (fractional)} \\ d_{\text{K}_\text{start}} &= d_{\oplus_\text{max}} - 287 \\ % March 20 y_\text{K} &= \begin{cases} y_\oplus - 892 & d_\oplus - d_{\text{K}_\text{start}} > 1 \\ y_\oplus - 892 - 1 & d_\oplus - d_{\text{K}_\text{start}} \leq 1 \end{cases} \\ d_{\text{K}_\text{max}} &= \begin{cases} 391 & y_\text{K} = 65 \pmod{239} \text{ and } y_\text{K} = 2 \pmod{4} \\ 390 & y_\text{K} = 65 \pmod{239} \\ 390 & y_\text{K} = 2 \pmod{4} \\ 389 & \text{otherwise} \end{cases} \\ d_\text{K} &= \begin{cases} \frac{d_\oplus - d_{\text{K}_\text{start}}}{d_{\oplus_\text{max}}} \times d_{\text{K}_\text{max}} & d_\oplus - d_{\text{K}_\text{start}} > 1 \\ \frac{d_\oplus - d_{\text{K}_\text{start}}}{d_{\oplus_\text{max}}} \times d_{\text{K}_\text{max}} + d_{\text{K}_\text{max}} & d_\oplus - d_{\text{K}_\text{start}} \leq 1 \end{cases} \\ L &= \lfloor \frac{d_\text{K} - 1}{32} \rfloor + 1 \\ d_{\text{K}_\text{L}} &= \lfloor d_\text{K} \rfloor - 32 \times (L - 1) \end{aligned}