Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getwhen($time) {
- $when = date('Y-m-d', strtotime($time));
- $when = strtotime($when);
- $curr = strtotime(date("Y-m-d"));
- $date = $when - $curr;
- $diff = floor($date/(60*60*24));
- if($diff == 0):
- echo 'today';
- elseif($diff > 1):
- echo 'future time';
- elseif($diff > 0):
- echo 'tomorrow';
- elseif($diff < -1):
- echo 'back time';
- else:
- echo 'yesterday';
- endif;
- }
- $date = '2020-04-24 10:00:00';
- echo getwhen($date);
Advertisement
Add Comment
Please, Sign In to add comment