perldoc > Time::JulianDay

📘 NAME

Time::JulianDay — Julian calendar manipulations

🚀 Quick Reference

Use CaseCommandDescription
Get Julian Day from date julian_day($year, $month, $day) Convert Gregorian date to Julian Day Number
Get local Julian Day from epoch local_julian_day($seconds) Convert seconds since 1970 to local Julian Day
Get GMT Julian Day from epoch gm_julian_day($seconds) Convert seconds since 1970 to GMT Julian Day
Get date from Julian Day inverse_julian_day($jd) Convert Julian Day to year, month, day
Get day of week day_of_week($jd) Day of week (0=Sunday, 6=Saturday)
Convert Julian Day to local seconds jd_secondslocal($jd, $hour, $min, $sec) Seconds since 1970 from Julian Day and time (local)
Convert Julian Day to GMT seconds jd_secondsgm($jd, $hour, $min, $sec) Seconds since 1970 from Julian Day and time (GMT)
Convert local time to seconds jd_timelocal($sec,$min,$hours,$mday,$month_0_to_11,$year) Inverse of localtime using month 0–11
Convert GMT time to seconds jd_timegm($sec,$min,$hours,$mday,$month_0_to_11,$year) Inverse of gmtime using month 0–11

📖 SYNOPSIS

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)

📝 DESCRIPTION

JulianDay is a package that manipulates dates as number of days since some time a long time ago. It's easy to add and subtract time using julian days...

The day_of_week returned by day_of_week() is 0 for Sunday, and 6 for Saturday and everything else is in between.

⚠️ ERRATA

Time::JulianDay is not a correct implementation. There are two problems. The first problem is that Time::JulianDay only works with integers. Julian Day can be fractional to represent time within a day. If you call inverse_julian_day() with a non-integer time, it will often give you an incorrect result.

The second problem is that Julian Days start at noon rather than midnight. The julian_day() function returns results that are too large by 0.5.

What to do about these problems is currently open for debate. I'm tempted to leave the current functions alone and add a second set with more accurate behavior.

There is another implementation in Astro::Time that may be more accurate.

📜 GENESIS

Written by David Muir Sharnoff <cpan AT dave.org> with help from previous work by Kurt Jaeger aka PI <zrzr0111 AT helpdesk.de> based on postings from: Ian Miller <ian_m AT cix.uk>; Gary Puckering <garyp%cognos.uucp AT uunet.net> based on Collected Algorithms of the ACM ?; and the unknown-to-me author of Time::Local.

📄 LICENSE

Copyright (C) 1996-1999 David Muir Sharnoff. License hereby granted for anyone to use, modify or redistribute this module at their own risk. Please feed useful changes back to cpan AT dave.org.

Time::JulianDay
📘 NAME 🚀 Quick Reference 📖 SYNOPSIS 📝 DESCRIPTION ⚠️ ERRATA 📜 GENESIS 📄 LICENSE

Generated by phpman v4.9.26-5-g7740029 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-08-21 19:12 @216.73.217.134
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!