Arabic/Hijri Maketime:

Arabic and Islamic customization of PHP mktime function. It can convert Hijri date into UNIX timestamp format.

UNIX timestamp

Development of the Unix operating system began at Bell Laboratories in 1969 by Dennis Ritchie and Ken Thompson, with the first PDP-11 version becoming operational in February 1971. Unix wisely adopted the convention that all internal dates and times (for example, the time of creation and last modification of files) were kept in Universal Time, and converted to local time based on a per-user time zone specification. This far-sighted choice has made it vastly easier to integrate Unix systems into far-flung networks without a chaos of conflicting time settings.

The machines on which Unix was developed and initially deployed could not support arithmetic on integers longer than 32 bits without costly multiple-precision computation in software. The internal representation of time was therefore chosen to be the number of seconds elapsed since 00:00 Universal time on January 1, 1970 in the Gregorian calendar (Julian day 2440587.5), with time stored as a 32 bit signed integer (long in the original C implementation).

The influence of Unix time representation has spread well beyond Unix since most C and C++ libraries on other systems provide Unix-compatible time and date functions. The major drawback of Unix time representation is that, if kept as a 32 bit signed quantity, on January 19, 2038 it will go negative, resulting in chaos in programs unprepared for this. Modern Unix and C implementations define the result of the time() function as type time_t, which leaves the door open for remediation (by changing the definition to a 64 bit integer, for example) before the clock ticks the dreaded doomsday second.


Example Output 1:

Calculated first day of Ramadan 1429 unix timestamp is: 1220227200
Which is Monday September 1, 2008 in Gregorian calendar
That Ramadan has 30 days in total

Example Code 1:

<?php
    date_default_timezone_set
('UTC');

    
$Arabic = new \ArPHP\I18N\Arabic();

    
$correction $Arabic->mktimeCorrection(91429);
    
$time $Arabic->mktime(000911429$correction);    
    echo 
"Calculated first day of Ramadan 1429 unix timestamp is: $time<br>";
    
    
$Gregorian date('l F j, Y'$time);
    echo 
"Which is $Gregorian in Gregorian calendar";

    
$days $Arabic->hijriMonthDays(91429);
    echo 
"That Ramadan has $days days in total";

Related Documentation: mktimeCorrection, mktime, hijriMonthDays