Req #52972 [Opn->Sus]: Support Persian Calendar
| From: | cmb@php.net | Date: | Sun, 13 Aug 2017 00:56:39 +0000 |
| Subject: | Req #52972 [Opn->Sus]: Support Persian Calendar | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-210644@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=52972&edit=1
ID: 52972
Updated by: cmb@php.net
Reported by: takmahdi at gmail dot com
Summary: Support Persian Calendar
-Status: Open
+Status: Suspended
Type: Feature/Change Request
Package: Calendar related
Operating System: Linux/Windows
PHP Version: 5.3.3
Block user comment: N
Private report: N
New Comment:
Thank you for your interest in PHP and for submitting a feature
request. Please be aware that due to the magnitude of change this
request requires, it would be necessary to discuss it on PHP
Internals list (internals@lists.php.net) as an RFC. Please read
the guide about creating RFCs here:
<https://wiki.php.net/rfc/howto>. If you
haven't had experience
with writing RFCs before, it is advised to seek guidance on the
Internals list (<http://php.net/mailing-lists.php>) and/or solicit
help from one of the experienced developers.
Please do not consider this comment as a negative view on the
merits of your proposal â every proposal which requires changes of
certain magnitude, even the very successful and widely supported
ones, must be done through the RFC process. This helps make the
process predictable, transparent and accessible to all developers.
Previous Comments:
------------------------------------------------------------------------
[2010-10-02 19:54:57] takmahdi at gmail dot com
Description:
------------
Hi,
I want use Persian calendar in PHP, but not support this feature; In Iran we use
none standard script for implement this feature and It is not likely...!
If year%33 remaining 1, 5, 9, 13, 17, 22, 26, 30 this year will calling leap
year.
Persian calendar:
months/abbrevmonths are: Farvardin, Ordibehesht, Khordad, Tir, Mordad,
Shahrivar, Mehr, Aban, Azar, Dey, Bahman, Esfand
daysname/abbrevdaysname: Yekshanbeh = Sunday, Doshanbeh, Seshhanbeh,
Chaharshanbeh, Panjshanbeh, Jomeh, Shanbeh
week begin from Shanbeh
days range in month: 29-31
I use below script:
http://www.fourmilab.ch/documents/calendar/
Thanks for cooperation.
Regards
Test script:
---------------
const CAL_PERSIAN = 4;
const PERSIAN_EPOCH = 1948320.5;
function Persian2JD($year, $month, $day) {
$epbase = $year - (($year >= 0) ? 474 : 473);
$epyear = 474 + $epbase%2820;
return $day + (($month <= 7) ? (($month - 1) * 31) : ((($month - 1) *
30) + 6)) + (int)((($epyear * 682) - 110) / 2816) + ($epyear - 1) * 365 +
(int)($epbase / 2820) * 1029983 + (PERSIAN_EPOCH - 1);
}
function JD2Persian($jd) { # Calculate Persian date from Julian day
$jd = (int)$jd + 0.5;
$depoch = $jd - Persian2JD(475, 1, 1);
$cycle = (int)($depoch / 1029983);
$cyear = $depoch%1029983;
if ($cyear == 1029982)
$ycycle = 2820;
else {
$aux1 = (int)($cyear / 366);
$aux2 = $cyear%366;
$ycycle = (int)(((2134 * $aux1) + (2816 * $aux2) + 2815) /
1028522) + $aux1 + 1;
}
$year = $ycycle + (2820 * $cycle) + 474;
if ($year <= 0)
$year--;
$yday = ($jd - Persian2JD($year, 1, 1)) + 1;
$month = ($yday <= 186) ? ceil($yday / 31) : ceil(($yday - 6) / 30);
$day = ($jd - Persian2JD($year, $month, 1)) + 1;
return $year.'-'.str_pad($month, 2, 0, STR_PAD_LEFT).'-'.str_pad($day,
2, 0, STR_PAD_LEFT);
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=52972&edit=1