PERSIANLITY
New Member
سلام !
چطوری میشه این فانکشنهارو برای تبدیل به تاریخ شمسی ادیت کرد ؟؟
چطوری میشه این فانکشنهارو برای تبدیل به تاریخ شمسی ادیت کرد ؟؟
PHP:
function CCDaysInMonth($year, $month) {
switch ($month) {
case 4:
case 6:
case 9:
case 11:
return 30;
case 2:
if ($year % 4)
return 28;
elseif ($year % 100)
return 29;
elseif ($year % 400)
return 28;
else return 29;
default:
return 31;
}
}
function CCDayOfWeek($date) {
//return 1 - Sun, 2 - Mon, 3 - Tue ...
$year = $date[ccsYear];
$month = $date[ccsMonth];
$day = $date[ccsDay];
$century = $year - ( $year % 100 );
$base = array( 3, 2, 0, 5 );
$base = $base[(($century - 1500) / 100 + 16) % 4];
$twelves = intval(($year - $century )/12);
$rem = ($year - $century) % 12;
$fours = intval($rem / 4);
$doomsday = $base + ($twelves + $rem + $fours) % 7;
$doomsday = $doomsday % 7;
$base = array( 0, 0, 7, 4, 9, 6, 11, 8, 5, 10, 7, 12 );
if (CCDaysInMonth($year, 2) == 29) {
$base[0] = 32;
$base[1] = 29;
} else {
$base[0] = 31;
$base[1] = 28;
}
$on = $day - $base[$month - 1];
$on = $on % 7;
return ($doomsday + $on + 7) % 7 + 1;
}
function CCDayOfYear($date) {
$days = 0;
for ($month = 1; $month < $date[ccsMonth]; $month++)
$days += CCDaysInMonth($date[ccsYear], $month);
return $days + $date[ccsDay];
}









