The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

        Date::Indian    -A module for Indian calendrical calculations.

SYNOPSIS

        use     Date::Indian;
        my $date = Indian->date(
                ymd     => '2003:1:1',
                tz      => '5:30',
                locn    => '78:18 17:12'
        );

DESCRIPTION

        This module is not a calander generator. It helps to wirte one by 
        providing essential and auxillary services.
        
        Services offered by this module are:

         1. Sun rise/set.
         2. Moon rise/set.
         3. Tithi at a given time.
         4. Moon's constallatation at a given time.
         5. Tithi ending time(s) on a given day.
         6. Moon's constallation change time(s) on a given day.
         7. Length of the day (sunrise to sunset).
         8. Previous / current new moon date and time.
         9. Next new moon date and time.
        10. Rahu kalam.
        11. Gulika kalam.
        12. Yama gandam.
        13. Durmuhurta periods.
        14. Current yoga.
        15. Current karana.
        16. Yoga change time(s) on given day.
        17. Karana change time(s) on given day.
        18. Weekday.
        19. Julian day.
        20. ymdt ( year, month, day and time values)
        21. Ayanamsa.
        22.

SERVICES

Here is a description of the services provided by the module.

Gregorian date and time.

This service provides the date ( and time of the day in hours & fraction of hours ) for the given date object.

my (@y, $m, $d, $t ) = $date -> ymd();

Sun rise and Sun set

This service is provided by the method sunriseset().

($sunrise, $sunset, $flag) = $date -> sunriseset();

Depending the latitude and time of the year, the Sun may not rise or set at a given location. This is indicated by the $flag string data.

Moon rise and Moon set

This service is provided by the method moonriseset().

($moonrise, $moonset, $flag) = $date -> moonriseset();

At times the Moon may set or rise more than once on a gicen calendar day. Also some days the Moon will not rise or set. Such cases are indicated by the $flag string.

Tithi

This service is provided by the the following methods.

Tithi at a given time.

The method 'tithi' provides this service.

my $tithi = $date -> tithi(<time of the day>);

where the time of the day is expressed as a decimal fraction in the range 0.0 ..... 1.0 where a 0 value means at 00:00 hrs of the calendar date and 0.5 the 12:00 noon and 1.0 the begining of the next day.

Tithi endings.

The method tithi_endings() provides the service of itentifying when the a tithi ending occurs on a given date.

my %t_times = $date->tithi_endings();

At times more than one tithi may end on the same calendar date and on some days none ends. Hence the method returns an hash where keys are tithi numbers in the range 0...29 and values corrosponding are times in hours at local time. Note that the hash may be empty if no tithi ends on a given calendar date.

Nakshatra
Nakshyatra at a given time.

The method serving is nakshyatra().

$n_time = $date -> nakshyatra(<time of the day>)

Nakshyatra endings.

my %n_endings = $date -> nakshyatra_endings ();

This service is analogous to the tithi_endings service.

Length of the day

The length of the day is kind of misnomer. It actually is the duration of the Sun's visibility defined as

     sun set - sun rise

on a given day provied they both are meaningful.

The usage is

$d_length = $date -> daylength();

New moon time

The date and time of the most recent new moon is provided by the service.

my $pnm = $date -> newmoon();

The service allowes you to find the 'n' th new moon, if that is needed.

my $next_newmoon = $date -> newmoon(1);

Varjyam

This is provided by the method varjyam

my @varjyam = $date -> varjyam();

The array returned provides starting times of varjya periods on the given date. The ending time of any varjya is always 1.6 hours from the respective start time. So, ending times are seperately not provided by the method.

Rahu kalam

This is provided by the method rahu_kalam.

my ($rk_start, $rk_end) = $date -> rahu_kalam ();

The periods of time rahu kalam are controlled by time of sun rise, duration of the Sun's visibile time and the week day.

Gulika kalam

This is provided by the method gulika_kalam.

my ($gk_start, $gk_end) = $date -> gulika_kalam();

The periods of time gulika kalam are controlled by time of sun rise, duration of the Sun's visibile time and the week day.

Yamaganda kalam

This is provided by the method yamaganda_kalam.

my ($yg_start, $yg_end) = $date -> yamaganda_kalam();

The periods of time yama ganda kalam are controlled by time of sun rise, duration of the Sun's visibile time and the week day.

Durmuhurtam

This is provided by the method durmuhurtam.

my ($dm1_start, $dm1_end, $dm2_start, $dm2_end) = $date -> drmuhurtam();

The periods of time durmuhurtam are controlled by time of sun rise, duration of the Sun's visibile time and the week day. There may be one or two durmuhurtha periods on a given day.

Karana

This service is provided by a couple of methods.

Kanana at a given time

This service is provided by the method karana(). Usage is

my $k = $date -> karana( <time of the day> )

Karana ending times

This service works in same way as tithi_endings and nakshyatra_endings. Note that the karana numbers are in the range 0...,59. But as there are only 11 karanas, one need to map the karanas to the correct range 0...11 This at present left to the user. ( Consult the demo file for a solution )

Sun's position (Karte)

This service is provided by the method sunchara().

my ($nav, $t) = $date -> sunchar();

where $nav is the Sun's navamsa number on the zodiac in the range 0...107. and $t represents the time of change of navamsa.

Depending on what navamsa number is returned one can understand whether the Sun is entering a different navamsa, different nakshyatra or a different sign on the zodiac.

Yoga

The yoga servvice is provided by a couple of methods.

Yoga at a given time.

Use yoga() method.

my $yoga = $date -> yoga (<time of the day>);

Yoga ending times.

my %y_end = $date -> yoga_endings();

This method works similar to tithi_endings().