Skip to content

Latest commit

 

History

History
26 lines (19 loc) · 739 Bytes

README.md

File metadata and controls

26 lines (19 loc) · 739 Bytes

Twitter Time Ago

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);