Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function getDates($sDate, $eDate=NULL){
- $tgl_libur = is_array($tgl_libur) ? $tgl_libur : array($tgl_libur);
- $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++) {
- $days[] = date("Y-m-d", ($startDate + ($i * $day)));
- }
- return $days;
- }
- $ti1 = $_GET['month_start'];
- $ti2 = $_GET['month_end'];
- $tgls = getDates($ti1,$ti2);
- for($i=0;$i<=count($tgls)-1;$i++)
- $data_bulan[substr($tgls[$i],0,7)] = $i;
- $data_bulan = array_keys($data_bulan);
- print_r($data_bulan);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement