\LobbyTime

Handle time conversions and date outputs

Summary

Methods
Properties
Constants
__constructStatic()
loadConfig()
now()
date()
getTimezone()
getTimeago()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$tz
N/A

Properties

$tz

$tz : 

The user's timezone

Type

Methods

__constructStatic()

__constructStatic() 

Sets the PHP & database timezone as UTC

loadConfig()

loadConfig() 

Load the user's timezone config

now()

now(string  $format = "Y-m-d H:i:s") : string

Return the current instant's timestamp

Parameters

string $format

The format of timestamp to be returned

Returns

string —

Timestamp

date()

date(string  $date, string  $format = "Y-m-d H:i:s") : \Lobby\Timestamp

Convert a UTC date to user's timezone

Parameters

string $date

UTC date that is compatible with \DateTime()

string $format

The format of timestamp to be returned

Returns

\Lobby\Timestamp

getTimezone()

getTimezone(string  $offset) : string

Convert offsets to timezone

Parameters

string $offset

Offset like "GMT+5:30" etc.

Returns

string —

Timezone of offest

getTimeago()

getTimeago(integer  $time) : string

Get timeago value from timestamp

Parameters

integer $time

Timestamp

Returns

string —

Values like "about 2 seconds ago"