Procedural File: Mktime.php
Source Location: /Arabic/Mktime.php
Classes:
I18N_Arabic_Mktime
This PHP class is an Arabic customization for PHP mktime function
Page Details:
----------------------------------------------------------------------
Copyright (c) 2006-2016 Khaled Al-Sham'aa. http://www.ar-php.org PHP Version 5 ---------------------------------------------------------------------- LICENSE This program is open source product; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 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. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/lgpl.txt>. ---------------------------------------------------------------------- Class Name: Arabic Maketime Filename: Mktime.php Original Author(s): Khaled Al-Sham'aa <khaled@ar-php.org> Purpose: Arabic customization for PHP mktime function ---------------------------------------------------------------------- Arabic Maketime PHP class for Arabic and Islamic customization of PHP mktime function. It can convert Hijri date into UNIX timestamp format Unix time() value: 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. mktime -- Get Unix timestamp for a date int mktime (int hour, int minute, int second, int month, int day, int year); Warning: Note the strange order of arguments, which differs from the order of arguments in a regular Unix mktime() call and which does not lend itself well to leaving out parameters from right to left (see below). It is a common error to mix these values up in a script. Returns the Unix timestamp corresponding to the arguments given. This timestamp is a long integer containing the number of seconds between the Unix Epoch (January 1 1970) and the time specified. Example:
include('./I18N/Arabic.php');
$time = $obj->mktime(0,0,0,9,1,1427);
echo "<p>Calculated first day of Ramadan 1427 unix timestamp is: $time</p>";
$Gregorian = date('l F j, Y',$time);
echo "<p>Which is $Gregorian in Gregorian calendar</p>";
Tags:
|