Skip to content

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

License

Notifications You must be signed in to change notification settings

rymanalu/twitter-time-ago

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages