rymanalu/twitter-time-ago

Displays the date in a "time ago" format like Twitter.

v1.0.0 2016-12-21 15:33 UTC

This package is auto-updated.

Last update: 2024-12-09 16:11:11 UTC


README

Build Status

This package provides a function to parse a datetime to human readable time difference like Twitter.

Installation

composer require rymanalu/twitter-time-ago

Usage

use Rymanalu\TwitterTimeAgo\TwitterTimeAgo;

$timeAgo = new TwitterTimeAgo; // or `new TwitterTimeAgo($timezone)`
echo $timeAgo->parse('2016-12-21 12:06:45');
// You can also just pass a date...
echo $timeAgo->parse('2016-12-12');

// Using static method...
echo TwitterTimeAgo::parse('2016-12-21 12:06:45');

// Using global helper...
echo twitter_time_ago($datetime);