Created
August 10, 2020 07:51
-
-
Save inuvalogic/40ed300db5f4a9573fbcdfe1b3318b29 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ClassName | |
{ | |
private function date_range($first, $last, $step = '+1 day', $output_format = 'Y-m-d' ) | |
{ | |
$dates = array(); | |
$current = strtotime($first); | |
$last = strtotime($last); | |
while( $current <= $last ) { | |
$dates[] = date($output_format, $current); | |
$current = strtotime($step, $current); | |
} | |
return $dates; | |
} | |
public function store() | |
{ | |
$mulai = date("Y-m-d"); | |
$akhir = date("Y-m-d", strtotime($mulai." +12 week")); | |
$data = $this->date_range($mulai, $akhir, "+7 day"); | |
$data_libur = array('2020-08-17', '2020-08-21'); | |
$tanggal_cicilan = array(); | |
foreach ($data as $tanggal) { | |
if (!in_array($tanggal, $data_libur)){ | |
$tanggal_cicilan[] = $tanggal; | |
} | |
} | |
var_export($tanggal_cicilan); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment