Advertisement
krot

data diff

Sep 1st, 2019
456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.22 KB | None | 0 0
  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;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement