Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getDates($sDate, $eDate=NULL){
- $eDate = $eDate ? $eDate : date('Y-m-d');
- $day = 86400;
- if(strtotime($sDate)>strtotime($eDate)){
- $startDate = strtotime($eDate);
- $endDate = strtotime($sDate);
- }else{
- $startDate = strtotime($sDate);
- $endDate = strtotime($eDate);
- }
- $numDays = round(($endDate - $startDate) / $day) + 1;
- $days = array();
- for ($i = 0; $i < $numDays; $i++) {
- $tgl = date($format, ($startDate + ($i * $day)));
- $hari = date('w', ($startDate + ($i * $day)));
- $days[] = $tgl;
- }
- return array_values(array_filter($days));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement