Module:Keppel date/doc: Difference between revisions
More actions
Tesinormed (talk | contribs) No edit summary Tags: Reverted 2017 source edit |
Tesinormed (talk | contribs) No edit summary Tags: Reverted 2017 source edit |
||
| Line 8: | Line 8: | ||
y_\oplus &= \text{Earth year} \\ |
y_\oplus &= \text{Earth year} \\ |
||
d_\oplus &= \text{Earth day of year (fractional)} \\ |
d_\oplus &= \text{Earth day of year (fractional)} \\ |
||
\text{days}_\oplus(y) &= \begin{cases} |
|||
366 & (y = 0 \pmod{4} \text{ and } y \neq 0 \pmod{100}) \text{ or } y = 0 \pmod{400} \\ |
366 & (y = 0 \pmod{4} \text{ and } y \neq 0 \pmod{100}) \text{ or } y = 0 \pmod{400} \\ |
||
365 & \text{otherwise} |
365 & \text{otherwise} |
||
\end{cases} \\ |
\end{cases} \\ |
||
\text{offset}(y) &= \text{days}_\oplus(y) - 287 \\ |
|||
\text{days}_\text{K}(y) &= \begin{cases} |
|||
391 & y = 65 \pmod{239} \text{ and } y = 2 \pmod{4} \\ |
391 & y = 65 \pmod{239} \text{ and } y = 2 \pmod{4} \\ |
||
390 & y = 65 \pmod{239} \text{ or } |
390 & y = 65 \pmod{239} \text{ or } y = 2 \pmod{4} \\ |
||
389 & \text{otherwise} |
389 & \text{otherwise} |
||
\end{cases} \\ |
\end{cases} \\ |
||
y_\text{K} &= \begin{cases} |
y_\text{K} &= \begin{cases} |
||
y_\oplus - 892 & d_\oplus - |
y_\oplus - 892 & d_\oplus - \text{offset}(y)(y_\oplus) \geq \frac{\text{days}_\oplus(y_\oplus)}{\text{days}_\text{K}(y_\oplus - 892)} \\ |
||
y_\oplus - 892 - 1 & d_\oplus - |
y_\oplus - 892 - 1 & d_\oplus - \text{offset}(y)(y_\oplus) < \frac{\text{days}_\oplus(y_\oplus)}{\text{days}_\text{K}(y_\oplus - 892)} |
||
\end{cases} \\ |
\end{cases} \\ |
||
d_\text{K} &= (\frac{d_\oplus - |
d_\text{K} &= (\frac{d_\oplus - \text{offset}(y)(y_\oplus)}{\text{days}_\oplus(y_\oplus)} \times \text{days}_\text{K}(y_\text{K}) - 1) \bmod{\text{days}_\text{K}(y_\text{K})} + 1 \\ |
||
L &= \lfloor \frac{d_\text{K} - 1}{32} \rfloor + 1 \\ |
L &= \lfloor \frac{d_\text{K} - 1}{32} \rfloor + 1 \\ |
||
d_L &= \lfloor (d_\text{K} - 1) \bmod{32} \rfloor + 1 |
d_L &= \lfloor (d_\text{K} - 1) \bmod{32} \rfloor + 1 |
||
Revision as of 21:33, 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{Earth day of year (fractional)} \\ \text{days}_\oplus(y) &= \begin{cases} 366 & (y = 0 \pmod{4} \text{ and } y \neq 0 \pmod{100}) \text{ or } y = 0 \pmod{400} \\ 365 & \text{otherwise} \end{cases} \\ \text{offset}(y) &= \text{days}_\oplus(y) - 287 \\ \text{days}_\text{K}(y) &= \begin{cases} 391 & y = 65 \pmod{239} \text{ and } y = 2 \pmod{4} \\ 390 & y = 65 \pmod{239} \text{ or } y = 2 \pmod{4} \\ 389 & \text{otherwise} \end{cases} \\ y_\text{K} &= \begin{cases} y_\oplus - 892 & d_\oplus - \text{offset}(y)(y_\oplus) \geq \frac{\text{days}_\oplus(y_\oplus)}{\text{days}_\text{K}(y_\oplus - 892)} \\ y_\oplus - 892 - 1 & d_\oplus - \text{offset}(y)(y_\oplus) < \frac{\text{days}_\oplus(y_\oplus)}{\text{days}_\text{K}(y_\oplus - 892)} \end{cases} \\ d_\text{K} &= (\frac{d_\oplus - \text{offset}(y)(y_\oplus)}{\text{days}_\oplus(y_\oplus)} \times \text{days}_\text{K}(y_\text{K}) - 1) \bmod{\text{days}_\text{K}(y_\text{K})} + 1 \\ L &= \lfloor \frac{d_\text{K} - 1}{32} \rfloor + 1 \\ d_L &= \lfloor (d_\text{K} - 1) \bmod{32} \rfloor + 1 \end{aligned}