function unix2doty(unix) {
const dote = unix / 86400 + 719468,
= Math.floor((
cykl >= 0 ? dote
dote : dote - 146096
/ 146097),
) = dote - cykl * 146097,
dotc = Math.floor((dotc
yotc - Math.floor(dotc / 1460)
+ Math.floor(dotc / 36524)
- Math.floor(dotc / 146096)
/ 365);
) return [
+ cykl * 400,
yotc - (yotc * 365
dotc + Math.floor(yotc / 4)
- Math.floor(yotc / 100)
)]}
Ordinal date
My site is full of dates in the year+day
format. The major advantage of this format is that the day
component can unequivocally identify any date and time in a given year and thus can replace months, days of the month, hours, minutes, and seconds. In essence, the day
number can To create all of the dates, I use three different programming languages: Python for the listing page, Lua for the Published date at the top of each article, and JavaScript for the citation information at the bottom of each article.
To test the code, I will create a separate Quarto markdown (qmd
) file for each of these 3 programming languages and embed them into this qmd
file.
Citation
BibTeX citation:
@online{laptev2024,
author = {Laptev, Martin},
title = {Ordinal Date},
date = {2024},
urldate = {2024},
url = {https://maptv.github.io/dec/date},
langid = {en}
}
For attribution, please cite this work as:
Laptev, Martin. 2024. “Ordinal Date.” 2024. https://maptv.github.io/dec/date.