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

Calendar::Saka - Interface to Saka Calendar (Indian).

VERSION

Version 0.01

SYNOPSIS

Module to play with Saka calendar mostly used in the South indian, Goa and Maharashatra. It have functionality to add/minus days, months and years to a Saka date. It can also converts Saka date to Gregorian/Julian date.

                            Phalguna [1932]

                    Sun  Mon  Tue  Wed  Thu  Fri  Sat
                      1    2    3    4    5    6    7
                      8    9   10   11   12   13   14
                     15   16   17   18   19   20   21
                     22   23   24   25   26   27   28
                     29   30

METHODS

as_string()

Return Saka date in human readable format.

    use strict; use warnings;
    use Calendar::Saka;
    
    my $saka = Calendar::Saka->new(1932,12,26);
    print "Saka date is " . $saka->as_string() . "\n";
   

today()

Return today's date is Sake calendar as list in the format yyyy,mm,dd.

    use strict; use warnings;
    use Calendar::Saka;
    
    my $saka = Calendar::Saka->new();
    my ($yyyy, $mm, $dd) = $saka->today();
    print "Year [$yyyy] Month [$mm] Day [$dd]\n";

mon(mm)

Return name of the given month according to the Saka Calendar.

    use strict; use warnings;
    use Calendar::Saka;
    
    my $saka = Calendar::Saka->new();
    print "Month name: [" . $saka->mon() . "]\n";

dow(yyyy, mm, dd)

Get day of the week of the given Saka date, starting with sunday (0).

    use strict; use warnings;
    use Calendar::Saka;
    
    my $saka = Calendar::Saka->new();
    print "Day of the week; [" . $saka->dow() . "]\n";

days_in_year_month(yyyy, mm)

Return number of days in the given year and month of Saka calendar.

    use strict; use warnings;
    use Calendar::Saka;
    
    my $saka = Calendar::Saka->new(1932,12,26);
    print "Days is Phalguna 1932: [" . $saka->days_in_year_month() . "]\n";

    print "Days is Caitra 1932: [" . $saka->days_in_year_month(1932,1) . "]\n";

add_days(no_of_days)

Add no_of_days to the Sake date.

    use strict; use warnings;
    use Calendar::Saka;
    
    my $saka = Calendar::Saka->new(1932,12,5);
    print "Saka 1:" . $saka->as_string() . "\n";
    $saka->add_days(5);
    print "Saka 2:" . $saka->as_string() . "\n";

minus_days(no_of_days)

Minus no_of_days from the Sake date.

    use strict; use warnings;
    use Calendar::Saka;
    
    my $saka = Calendar::Saka->new(1932,12,5);
    print "Saka 1:" . $saka->as_string() . "\n";
    $saka->minus_days(2);
    print "Saka 2:" . $saka->as_string() . "\n";

add_months(no_of_months)

Add no_of_months to the Saka date.

    use strict; use warnings;
    use Calendar::Saka;
    
    my $saka = Calendar::Saka->new(1932,1,1);
    print "Saka 1:" . $saka->as_string() . "\n";
    $saka->add_months(2);
    print "Saka 2:" . $saka->as_string() . "\n";

minus_months(no_of_months)

Mnus no_of_months from the Saka date.

    use strict; use warnings;
    use Calendar::Saka;
    
    my $saka = Calendar::Saka->new(1932,5,1);
    print "Saka 1:" . $saka->as_string() . "\n";
    $saka->minus_months(2);
    print "Saka 2:" . $saka->as_string() . "\n";

add_years(no_of_years)

Add no_of_years to the Saka date.

    use strict; use warnings;
    use Calendar::Saka;
    
    my $saka = Calendar::Saka->new(1932,1,1);
    print "Saka 1:" . $saka->as_string() . "\n";
    $saka->add_years(2);
    print "Saka 2:" . $saka->as_string() . "\n";

minus_years(no_of_years)

Minus no_of_years from the Saka date.

    use strict; use warnings;
    use Calendar::Saka;
    
    my $saka = Calendar::Saka->new(1932,1,1);
    print "Saka 1:" . $saka->as_string() . "\n";
    $saka->minus_years(2);
    print "Saka 2:" . $saka->as_string() . "\n";

get_calendar(yyyy, mm)

Return calendar for given year and month in Saka calendar. It return current month of Saka calendar if no argument is passed in.

    use strict; use warnings;
    use Calendar::Saka;
    
    my $saka = Calendar::Saka->new(1932,1,1);
    print $saka->get_calendar();
    
    # Print calendar for year 1932 and month 12.
    print $saka->get_calendar(1932, 12);

to_gregorian(yyyy, mm, dd)

Convert Saka date to Gregorian date and return a list in the format yyyy,mm,dd.

    use strict; use warnings;
    use Calendar::Saka;
    
    my $saka = Calendar::Saka->new();
    print "Saka: " . $saka->as_string() . "\n";
    my ($yyyy, $mm, $dd) = $saka->to_gregorian();
    print "Gregorian [$yyyy] Month [$mm] Day [$dd]\n";

from_gregorian(yyyy, mm, dd)

Convert Gregorian date to Saka date and return a list in the format yyyy,mm,dd.

    use strict; use warnings;
    use Calendar::Saka;
    
    my $saka = Calendar::Saka->new();
    print "Saka 1: " . $saka->as_string() . "\n";
    my ($yyyy, $mm, $dd) = $saka->from_gregorian(2011, 3, 17);
    print "Saka 2: Year[$yyyy] Month [$mm] Day [$dd]\n";

to_julian(yyyy, mm, dd)

Convert Julian date to Saka date and return a list in the format yyyy,mm,dd.

    use strict; use warnings;
    use Calendar::Saka;
    
    my $saka = Calendar::Saka->new();
    print "Saka: " . $saka->as_string() . "\n";
    print "Julian: " . $saka->to_julian() ."\n";

from_julian()

Convert Julian date to Saka date and return a list in the format yyyy,mm,dd.

    use strict; use warnings;
    use Calendar::Saka;
    
    my $saka = Calendar::Saka->new();
    print "Saka 1: " . $saka->as_string() . "\n";
    my $julian = $saka->to_julian();
    my ($yyyy, $mm, $dd) = $saka->from_julian($julian);
    print "Saka 2: Year[$yyyy] Month [$mm] Day [$dd]\n";

AUTHOR

Mohammad S Anwar, <mohammad.anwar at yahoo.com>

BUGS

Please report any bugs or feature requests to bug-calendar-saka at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Calendar-Saka. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Calendar::Saka

You can also look for information at:

ACKNOWLEDGEMENTS

This module is based on javascript code written by John Walker founder of Autodesk, Inc. and co-author of AutoCAD.

LICENSE AND COPYRIGHT

Copyright 2011 Mohammad S Anwar.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

DISCLAIMER

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.