Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- comparasion date
- <?php
- $paymentDate = date('Y-m-d');
- $paymentDate=date('Y-m-d', strtotime($paymentDate));
- $contractDateBegin = date('Y-m-d', strtotime("2020-08-03"));
- $contractDateEnd = date('Y-m-d', strtotime("2020-08-03"));
- if (($paymentDate >= $contractDateBegin) && ($paymentDate <= $contractDateEnd)){
- echo "is between";
- }else{
- echo "NO GO!";
- }
- ?>
- // count date
- <?php
- $startTimeStamp = strtotime("2020-08-01");
- $endTimeStamp = strtotime("2020-08-01");
- $timeDiff = abs($endTimeStamp - $startTimeStamp);
- $numberDays = $timeDiff/86400; // 86400 seconds in one day
- // and you might want to convert to integer
- $numberDays = intval($numberDays);
- if($numberDays > 0){
- echo 'lebih dari 0';
- }else{
- echo $numberDays.' masih 0';
- }
- ?>
Add Comment
Please, Sign In to add comment