Skip to content

Instantly share code, notes, and snippets.

@sineld
Created October 5, 2012 08:10
Show Gist options
  • Select an option

  • Save sineld/3838694 to your computer and use it in GitHub Desktop.

Select an option

Save sineld/3838694 to your computer and use it in GitHub Desktop.
Php: gunleriBul
<?php
function gunleriBul($startTime, $endTime) {
$day = 86400;
$format = 'Y-m-d';
$startTime = strtotime($startTime);
$endTime = strtotime($endTime);
$numDays = round(($endTime - $startTime) / $day) + 1;
$days = array();
for ($i = 0; $i < $numDays; $i++) {
$days[] = date($format, ($startTime + ($i * $day)));
}
return $days;
}
$basla = '2012-03-21';
$bitis = '2012-05-03';
$days = gunleriBul($basla, $bitis);
foreach($days as $key => $value){
echo $value . '<br> ';
}
/*
2012-03-21
2012-03-22
2012-03-23
2012-03-24
2012-03-25
2012-03-26
2012-03-27
2012-03-28
2012-03-29
2012-03-30
2012-03-31
2012-04-01
2012-04-02
2012-04-03
2012-04-04
2012-04-05
2012-04-06
2012-04-07
2012-04-08
2012-04-09
2012-04-10
2012-04-11
2012-04-12
2012-04-13
2012-04-14
2012-04-15
2012-04-16
2012-04-17
2012-04-18
2012-04-19
2012-04-20
2012-04-21
2012-04-22
2012-04-23
2012-04-24
2012-04-25
2012-04-26
2012-04-27
2012-04-28
2012-04-29
2012-04-30
2012-05-01
2012-05-02
2012-05-03
*/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment