! مج ـرد إن ـسـآن !
21-12-2007, 05:07 صباحاً
السلام عليكم
وظيفة الدالة :
حساب عدد الأيام بين تاريخين
الدالة :
function DatesBetween($startDate, $endDate, $type='Y/m/j')
{
// get the number of days between the two given dates.
$days = (strtotime($endDate) - strtotime($startDate)) / 86400 + 1;
$startMonth = date("m", strtotime($startDate));
$startDay = date("d", strtotime($startDate));
$startYear = date("Y", strtotime($startDate));
$dates;//the array of dates to be passed back
for($i=0; $i<$days; $i++){
$dates[$i] = date($type, mktime(0, 0, 0, $startMonth , ($startDay+$i), $startYear));
}
return $dates;
}
طريقة الاستعمال :
DatesBetween(1, 2, 3)
1 = التاريخ الأول
2 = التاريخ الثاني
3 = شكل التاريخ (كمثال 2007/1/1 أو 2007-1-1 أو غيره)
ملاحظة :
وجدت الدالة في الموقع الرسمي ونقلتها لكم مع بعض التعديلات
أتمنى ان تنال على اعجابكم
منقول من الاخ العذاب
وظيفة الدالة :
حساب عدد الأيام بين تاريخين
الدالة :
function DatesBetween($startDate, $endDate, $type='Y/m/j')
{
// get the number of days between the two given dates.
$days = (strtotime($endDate) - strtotime($startDate)) / 86400 + 1;
$startMonth = date("m", strtotime($startDate));
$startDay = date("d", strtotime($startDate));
$startYear = date("Y", strtotime($startDate));
$dates;//the array of dates to be passed back
for($i=0; $i<$days; $i++){
$dates[$i] = date($type, mktime(0, 0, 0, $startMonth , ($startDay+$i), $startYear));
}
return $dates;
}
طريقة الاستعمال :
DatesBetween(1, 2, 3)
1 = التاريخ الأول
2 = التاريخ الثاني
3 = شكل التاريخ (كمثال 2007/1/1 أو 2007-1-1 أو غيره)
ملاحظة :
وجدت الدالة في الموقع الرسمي ونقلتها لكم مع بعض التعديلات
أتمنى ان تنال على اعجابكم
منقول من الاخ العذاب