krot

data diff

Sep 1st, 2019
109
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $dataMy= date('Ymd',time());
  2. $dlv='20190107170000';
  3. $dlv=substr($dlv,0,8);
  4.  
  5. $a = \DateTime::createFromFormat('Ymd', $dataMy );
  6. $b = \DateTime::createFromFormat('Ymd',$dlv);
  7. $interval = $a->diff($b);
  8.  
  9. echo $interval->days;
RAW Paste Data