Difference between two dates

2022-01-28 Thread cblake
Don't think there's an exposed impl, but here you go: proc julian*(year, month, day: int): int = let a = (14 - month) div 12 # See calendar FAQ$2.16.1 let y = year + 4800 - a let m = month + 12 * a - 3 (day + (153 * m + 2) div 5 + y * 365 + y div 4 - y

Difference between two dates

2022-01-28 Thread jdf
Sure but is there an exposed implementation or would I be rolling my own?

Difference between two dates

2022-01-27 Thread cagyul
Or you can simply calculate the difference in their Julian day numbers.

Difference between two dates

2022-01-26 Thread jdf
`std/times` seems to have [toEpochDay](https://github.com/nim-lang/Nim/blob/e49d52eb6174b2721293968e7811928c303c3776/lib/pure/times.nim#L461) and `fromEpochDay` but they're not exported. It would be useful if they were!