1Time::JulianDay(3) User Contributed Perl Documentation Time::JulianDay(3)
2
3
4
6 Time::JulianDay -- Julian calendar manipulations
7
9 use Time::JulianDay
10
11 $jd = julian_day($year, $month_1_to_12, $day)
12 $jd = local_julian_day($seconds_since_1970);
13 $jd = gm_julian_day($seconds_since_1970);
14 ($year, $month_1_to_12, $day) = inverse_julian_day($jd)
15 $dow = day_of_week($jd)
16
17 print (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[$dow];
18
19 $seconds_since_jan_1_1970 = jd_secondslocal($jd, $hour, $min, $sec)
20 $seconds_since_jan_1_1970 = jd_secondsgm($jd, $hour, $min, $sec)
21 $seconds_since_jan_1_1970 = jd_timelocal($sec,$min,$hours,$mday,$month_0_to_11,$year)
22 $seconds_since_jan_1_1970 = jd_timegm($sec,$min,$hours,$mday,$month_0_to_11,$year)
23
25 JulianDay is a package that manipulates dates as number of days since
26 some time a long time ago. It's easy to add and subtract time using
27 julian days...
28
29 The day_of_week returned by day_of_week() is 0 for Sunday, and 6 for
30 Saturday and everything else is in between.
31
33 Time::JulianDay is not a correct implementation. There are two
34 problems. The first problem is that Time::JulianDay only works with
35 integers. Julian Day can be fractional to represent time within a day.
36 If you call inverse_julian_day() with a non-integer time, it will often
37 give you an incorrect result.
38
39 The second problem is that Julian Days start at noon rather than
40 midnight. The julian_day() function returns results that are too large
41 by 0.5.
42
43 What to do about these problems is currently open for debate. I'm
44 tempted to leave the current functions alone and add a second set with
45 more accurate behavior.
46
47 There is another implementation in Astro::Time that may be more
48 accurate.
49
51 Written by David Muir Sharnoff <cpan@dave.sharnoff.org> with help from
52 previous work by Kurt Jaeger aka PI
53 <zrzr0111@helpdesk.rus.uni-stuttgart.de>
54 based on postings from: Ian Miller <ian_m@cix.compulink.co.uk>;
55 Gary Puckering <garyp%cognos.uucp@uunet.uu.net> based on Collected
56 Algorithms of the ACM ?; and the unknown-to-me author of Time::Local.
57
59 Copyright (C) 1996-1999 David Muir Sharnoff. License hereby granted
60 for anyone to use, modify or redistribute this module at their own
61 risk. Please feed useful changes back to cpan@dave.sharnoff.org.
62
63
64
65perl v5.28.1 2011-05-06 Time::JulianDay(3)