Documentation

TimeAgo
in package

This class can help you find out just how much time has passed between two dates.

It has two functions you can call:

  • inWords() which gives you the "time ago in words" between two dates.
  • dateDifference() which returns an array of years, months, days, hours, minutes and seconds between the two dates.
Tags
author

jimmiw

author

Samerton

version
2.0.0-pr8
license

MIT

site

http://github.com/jimmiw/php-time-ago

Table of Contents

Properties

$_secondsPerDay  : int
$_secondsPerHour  : int
$_secondsPerMinute  : int
$_secondsPerMonth  : int
$_secondsPerYear  : int
$_timezone  : string

Methods

__construct()  : mixed
dateDifference()  : array<string|int, mixed>
inWords()  : string

Properties

$_secondsPerDay

private int $_secondsPerDay = 86400

$_secondsPerHour

private int $_secondsPerHour = 3600

$_secondsPerMinute

private int $_secondsPerMinute = 60

$_secondsPerMonth

private int $_secondsPerMonth = 2592000

$_secondsPerYear

private int $_secondsPerYear = 31104000

$_timezone

private string $_timezone

Methods

__construct()

public __construct(string $timezone) : mixed
Parameters
$timezone : string

dateDifference()

public dateDifference(string $past[, string $now = 'now' ]) : array<string|int, mixed>
Parameters
$past : string
$now : string = 'now'
Return values
array<string|int, mixed>

inWords()

public inWords(string|int $past, Language $language) : string
Parameters
$past : string|int

Past time

$language : Language
Return values
string

Time ago string


        
On this page

Search results