NAME
DateTime::Calendar::Hebrew - Dates in the Hebrew calendar
SYNOPSIS
use DateTime::Calendar::Hebrew;
$dt = DateTime::Calendar::Hebrew->new( year => 5782,
month => 10,
day => 4 );
DESCRIPTION
DateTime::Calendar::Hebrew is the implementation of the Hebrew calendar. See README.hebrew for more details on the Hebrew calendar.
METHODS
new(...)
$dt = new Date::Calendar::Hebrew( year => 5782, month => 10, day => 5, );
This class method accepts parameters for each date and time component: "year", "month", "day", "hour", "minute", "second", "nanosecond" and "timezone". "year" is required, all the rest are optional. time fields default to '0', month/day fields to '1', timezone to 'floating'. All fields except year and timezone are tested for validity:
month : 1 to 13 day : 1 to 30 hour : 0 to 23 minute/second : 0 to 59
The days on the Hebrew calendar begin at sunset. If you want to know the Hebrew date, accurate with regard to local sunset, you can add a 'sunset' parameter. The sunset parameter must be a function-reference that accepts the parameters (year, month, day) and returns the time for sunset, local to your DateTime, in seconds-since-midnight. See README.sunset for more info.
from_object(object => $object)
This class method can be used to construct a new object from any object that implements the
utc_rd_values()
method. AllDateTime::Calendar
modules must implement this method in order to provide cross-calendar compatibility.set(...)
$dt->set( year => 5782, month => 1, day => 1, );
This method allows you to modify the values of the object. valid fields are "year", "month", "day", "hour", "minute", "second", "nanosecond" and "sunset". Returns the object being modified. Values are checked for validity just as they are in new().
utc_rd_values
Returns the current UTC Rata Die days and seconds as a three element list. This exists primarily to allow other calendar modules to create objects based on the values provided by this object.
utc_rd_as_seconds
Returns the current UTC Rata Die days and seconds purely as seconds. This is useful when you need a single number to represent a date.
clone
Returns a working copy of the object.
now
This class method returns an object created from DateTime->now.
today
This class method returns an object created from DateTime->today.
year
Returns the year.
month
Returns the month of the year, from 1..13.
day_of_month, day, mday
Returns the day of the month, from 1..30.
day_of_month_0, day_0, mday_0
Returns the day of the month, from 0..29.
month_name($month);
Returns the name of the given month. Called on an object ($dt->month_name), it returns the month name for the current month.
The Hebrew months are Nissan, Iyar, Sivan, Tammuz, (Menachem)Av, Elul, Tishrei, (Mar)Cheshvan, Kislev, Teves, Shevat & Adar. Leap years have "Adar II" or Second-Adar. If you feel that the order of the months is wrong, see README.hebrew.
day_of_week, wday, dow
Returns the day of the week as a number, from 1..7, with 1 being Sunday and 7 being Saturday.
day_of_week_0, wday_0, dow_0
Returns the day of the week as a number, from 0..6, with 0 being Sunday and 6 being Saturday.
day_name
Returns the name of the current day of the week.
day_of_year, doy
Returns the day of the year.
day_of_year_0, doy_0
Returns the day of the year, starting with 0.
ymd($optional_separator);
mdy($optional_separator);
dmy($optional_separator);
Each method returns the year, month, and day, in the order indicated by the method name. Years are zero-padded to four digits. Months and days are 0-padded to two digits.
By default, the values are separated by a dash (-), but this can be overridden by passing a value to the method.
hour
minute
second
Each method returns the parameter named in the method.
strftime($format, ...)
This method implements functionality similar to the
strftime()
method in C. However, if given multiple format strings, then it will return multiple elements, one for each format string.See DateTime for a list of all possible format specifiers. I implemented as many of them as I could.
INTERNAL FUNCTIONS
_from_rd($RD);
Calculates the Hebrew year, month and day from the RD.
_to_rd($year, $month, $day);
Calulates the RD from the Hebrew year, month and day.
_leap_year($year);
Returns true if the given year is a Hebrew leap-year.
_LastMonthOfYear($year);
Returns the number of the last month in the given Hebrew year. Leap-years have 13 months, Regular-years have 12.
_CalendarElapsedDays($year);
Returns the number of days that have passed from the Epoch of the Hebrew Calendar to the first day ofthe given year.
_DaysInYear($year);
Returns the number of days in the given year.
_LongCheshvan($year);
Returns true if the given year has an extended month of Cheshvan. Cheshvan can have 29 or 30 days. Normally it has 29.
_ShortKislev($year);
Returns true if the given year has a shortened month of Kislev. Kislev can have 29 or 30 days. Normally it has 30.
_LastDayOfMonth($year, $month);
Returns the length of the month in question, for the year in question.
BUGS
I must not have tested it enough, I'm not aware of any.
SUPPORT
Support for this module is provided via the datetime@perl.org email list. See http://lists.perl.org/ for more details.
AUTHOR
Steven J. Weinberger <perl@psycomp.com>
COPYRIGHT
Copyright (c) 2003 Steven J. Weinberger. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
datetime@perl.org mailing list
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 637:
You forgot a '=back' before '=head1'
- Around line 639:
'=item' outside of any '=over'