Answers for "php timeago"

PHP
3

function return time ago php

public function convert_time_to_days($date) {
       $current_date = date("Y-m-d H:m:s");
       $time = array();
       $day = floor((strtotime($current_date) - strtotime($date)) / (60 * 60 * 24));
 
       if ($day == 0) {
           $hour = floor((strtotime($current_date) - strtotime($date)) / (60 * 60));
 
           if ($hour == 0) {
               $minute = floor((strtotime($current_date) - strtotime($date)) / (60));
               $time = $minute . __d('course', "minutes ago");
 
           } else {
               $time = $hour . __d('course', "hours ago");
           }
      
       } else {
           $time = $day . __d('course', "days ago");
       }
      
       return $time;
   }
Posted by: Guest on October-06-2020
2

mysql time ago difference

#Need item created 12 hours ago or newer. Discards older than 12 hours
	 created_at >= (NOW() - INTERVAL 12 HOUR)
Posted by: Guest on October-27-2020
3

time php

<?php 
/* Unix Timestamp */
$timestamp = time();
echo $timestamp . "<br>";
echo date("d/m/Y", $timestamp);
?>
Posted by: Guest on October-06-2020
0

time function in php

Return the current time as a Unix timestamp, then format it to a date:
<?php 
/* Unix Timestamp */
$timestamp = time();
echo $timestamp . "<br>";
echo date("d/m/Y", $timestamp);
?>
Posted by: Guest on December-23-2020

Browse Popular Code Answers by Language