SHARE
TWEET

Untitled

a guest Jun 16th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $phpdate = strtotime( $data );
  2. $mysqldate = date( 'd-m-Y H:i:s', $phpdate );
  3. $data1 = strtotime($mysqldate);
  4. $data2 = strtotime("now");
  5. $data3 = (int)(-($data1 - $data2)/60);
  6. $data4 = (int)(($data3)/60);
  7. $datadia = (int)(($data4)/24);
  8.  
  9. if (!empty($data) and $data3<=60){
  10.    echo "Chegou $mysqldate<br>há $data3 minutos atrás<br>";                          
  11. }
  12. elseif (!empty($data)) {
  13.    echo "Chegou $mysqldate <br>há $data4 horas atrás<br>";
  14. }
  15.  elseif (!empty($data)) {
  16.    echo "Chegou $mysqldate <br>há $datadia dias atrás<br>";
  17. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top