View on
Ahmed Amin Elsheshtawy احمد امين الششتاوى جودة > Date-HijriDate-1.01 > Date::HijriDate



Annotate this POD

View/Report Bugs
Module Version: 1.01   Source  


Date::HijriDate - Hijri Islamic Dates Calendar


        use Date::HijriDate;

        my $day = 8;                    # day of the month
        my $month = 11;                 # month 0..11
        my $year = 2013;                # yyyy format
        my $caltype = 1;                # (0 = Julian; 1 = Gregorian)
        my $lang = "en";                # available languages: en, ar
        my %ret;
        # get Hijri date for specific Gregorian day
        #%ret = hijri_date($day, $month, $year, $caltype, $lang);
        # get current time in Hijri
        #%ret = hijri_now($caltype, $lang);

        # get Hijri time for the specific time stamp
        %ret = hijri_time(time, $caltype, $lang);

        # Western date
        $ret{month}++; # returned month 0..11
        print "Western date: $ret{day}-$ret{month}-$ret{year}\n";
        #Arithmetical calendar type             day     month   year (AH)        
        print "'Arithmetical calendar type'     day     month   'year (AH)'     'month name'\n";
        # all returned month 0..11

        #Method 1 civil, astronomical
        $ret{imonth1}++; $ret{imonth2}++;
        print "Ic [15, civil] $ret{iday1}-$ret{imonth1}-$ret{iyear1}  $ret{iname1}\n";
        print "Ia [15, astronomical] $ret{iday2}-$ret{imonth2}-$ret{iyear2}  $ret{iname2}\n";
        #Method 2 civil, astronomical
        $ret{imonth3}++; $ret{imonth4}++;
        print "IIc [16, civil] $ret{iday3}-$ret{imonth3}-$ret{iyear3}  $ret{iname3}\n";
        print "IIa [16, astronomical='MS HijriCalendar'] $ret{iday4}-$ret{imonth4}-$ret{iyear4}  $ret{iname4}\n";
        #Method 3 civil, astronomical
        $ret{imonth5}++; $ret{imonth6}++;
        print "IIIc [Fātimid, civil] $ret{iday5}-$ret{imonth5}-$ret{iyear5}  $ret{iname5}\n";
        print "IIIa [Fātimid, astronomical] $ret{iday6}-$ret{imonth6}-$ret{iyear6}  $ret{iname6}\n";
        #Method 4 civil, astronomical
        $ret{imonth7}++; $ret{imonth8}++;
        print "IVc [Habash al-Hāsib, civil] $ret{iday7}-$ret{imonth7}-$ret{iyear7}  $ret{iname7}\n";
        print "IVa [Habash al-Hāsib, astronomical] $ret{iday8}-$ret{imonth8}-$ret{iyear8}  $ret{iname8}\n";
        print "Julian day: $ret{julday}\n";
        print "Weekday number 0..7, 0=Sunday: $ret{wkday}\n";
        print "Hijri day name: $ret{itoday}\n";
        print "Calender type: ". (($ret{caltype} == 1)? "Gregorian" : "Julian") . "\n";
        print "\n\n";

        # print all dates information for all 8 calculation methods
        foreach my $k(sort keys %ret) {
                print "$k = $ret{$k}\n";
        # output

        Western date: 9-12-2013
        'Arithmetical calendar type'    day-month-'year (AH)'   'month name'    
        Ic [15, civil]          5-2-1435        Safar
        Ia [15, astronomical]   6-2-1435        Safar
        IIc [16, civil] 5-2-1435        Safar
        IIa [16, astronomical='MS HijriCalendar']       6-2-1435        Safar
        IIIc [Fātimid, civil]   5-2-1435        Safar
        IIIa [Fātimid, astronomical]    6-2-1435        Safar
        IVc [Habash al-Hāsib, civil]    5-2-1435        Safar
        IVa [Habash al-Hāsib, astronomical]     6-2-1435        Safar
        Julian day:     2456636
        Weekday number 0..7, 0=Sunday:  1
        Hijri day name: Ithnin
        Calender type:          Gregorian


This module calculates Islamic Hijri calender dates using civil and astronomical 8 methods.

        Arithmetical calendar type:
        Ic [15, civil]
        Ia [15, astronomical]
        IIc [16, civil]
        IIa [16, astronomical = "MS HijriCalendar"]
        IIIc [Fātimid, civil]
        IIIa [Fātimid, astronomical]
        IVc [Habash al-Hāsib, civil]
        IVa [Habash al-Hāsib, astronomical]

Exports three methods hijri_time, hijri_now, and hijri_date. All methods return date information in a single hash.

        %ret = hijri_time($time, $caltype, $lang);
        $time: unix time stamp;
        $caltype: 0 = Julian, 1 = Gregorian
        $lang: en, ar only currently supported for weekday and month names.
        %ret = hijri_now($caltype, $lang)
        return current Hijri time

        %ret = hijri_date($day, $month, $year, $caltype, $lang)
        return Hijri date for a given western date.
        $month: 0..11
        $year: yyyy format


Religion::Islam::Qibla Religion::Islam::Quran Religion::Islam::PrayTime Religion::Islam::PrayerTimes


Ahmed Amin Elsheshtawy, <> <> Website:


Copyright (C) 2013 by Dr. Ahmed Amin Elsheshtawy,

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: