Time::JulianDay(3pm)

πŸ‘‘ Time::JulianDay β€” bestie's guide to Julian calendar manipulations πŸ’–

okay so this is the Time::JulianDay page from the User Contributed Perl Documentation, and it's all about ✨ Julian calendar manipulations ✨. come sit with me, we're doing dates today πŸŽ€


🌈 SYNOPSIS 🌈

here's the whole vibe, verbatim, no notes 🫢

use Time::JulianDay

$jd = julian_day($year, $month_1_to_12, $day)
$jd = local_julian_day($seconds_since_1970);
$jd = gm_julian_day($seconds_since_1970);
($year, $month_1_to_12, $day) = inverse_julian_day($jd)
$dow = day_of_week($jd)

print (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$dow];

$seconds_since_jan_1_1970 = jd_secondslocal($jd, $hour, $min, $sec)
$seconds_since_jan_1_1970 = jd_secondsgm($jd, $hour, $min, $sec)
$seconds_since_jan_1_1970 = jd_timelocal($sec,$min,$hours,$mday,$month_0_to_11,$year)
$seconds_since_jan_1_1970 = jd_timegm($sec,$min,$hours,$mday,$month_0_to_11,$year)

literally the whole toolkit, go off πŸ’…


πŸ’« DESCRIPTION πŸ’«

so JulianDay is a package that manipulates dates as number of days since some time a long time ago. it's giving "ancient timestamp energy" and honestly? iconic. the whole point is that it's easy to add and subtract time using julian days... like, days are just numbers, you just do math on them, no cap πŸ”₯

and one important lil thing about day_of_week(): the $dow it hands back is 0 for Sunday, and 6 for Saturday, and everything else is in between. so Monday is 1, Tuesday is 2... you get it, bestie, it's just counting up from Sunday πŸ—“οΈ


πŸ’€ ERRATA πŸ’€

okay. deep breath. Time::JulianDay is not a correct implementation. not me exposing the package but here we are 😭 there are two problems and we're listing both, periodt.

problem one πŸ₯‡ β€” Time::JulianDay only works with integers. but a real Julian Day can be fractional, to represent time within a day. so if you call inverse_julian_day() with a non-integer time, it will often give you an incorrect result. that's a big yikes, bestie πŸ™ˆ

problem two πŸ₯ˆ β€” Julian Days start at <highlight>noon</highlight> rather than <highlight>midnight</highlight>. which means the julian_day() function returns results that are too large by 0.5. half a day off. lowkey unhinged, highkey documented 😭

what to do about these problems is currently open for debate. the author says β€” and I quote the vibe β€” that they're tempted to leave the current functions alone and add a second set with more accurate behavior. so like, character development pending 🧚

also, heads up: there is another implementation in Astro::Time that may be more accurate πŸ‘€ go check that if you need precision bestie

🫢 AUTHOR 🫢

Best Practical Solutions, LLC <modules@bestpractical.com> ✨

🌸 ORIGINAL AUTHOR 🌸

David Muir Sharnoff πŸŽ€

πŸ¦‹ GENESIS πŸ¦‹

this whole thing is based on previous work by Kurt Jaeger, Ian Miller, Gary Puckering (which was based on the Collected Algorithms of the ACM), and the author of Time::Local. a whole collab, a whole era, we love to see it πŸ’–


Copyright (C) 1996-1999 David Muir Sharnoff. Copyright (C) 2026 Best Practical Solutions, LLC.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. slay 🌈


aaaand that's the page babes πŸŽ€ this was Time::JulianDay(3pm), generated from perl v5.40.1, dated 2026-02-28 β€” remember: 0 is Sunday, 6 is Saturday, never trust fractional julian days from this module, and stay hydrated πŸ’–πŸ’…βœ¨

πŸ“¦ where this page comes from