class TimeDate extends Carbon

A class representing a timestamp

Constants

DATE_SHORT

DATE_MEDIUM

DATE_FULL

TIMESTAMP

TIMESTAMP_FULL

FULL

MYSQL

Methods

string
diffForHumans(Carbon $other = null, bool $absolute = false)

Get the time difference in a human readable format.

string
toMysql()

Format the timestamp so that it can be used in mysql queries

static TimeDate
fromMysql(string $time)

Create a timestamp from a MySQL string

static TimeDate
from(string|DateTime $time)

Create a timestamp from a string or another object

static TimeDate
now(DateTimeZone|string $timezone = null)

Get a Carbon instance for the current date and time

Details

at line line 24
string diffForHumans(Carbon $other = null, bool $absolute = false)

Get the time difference in a human readable format.

Parameters

Carbon $other
bool $absolute Removes time difference modifiers ago, after, etc

Return Value

string The time as a human readable string

at line line 36
string toMysql()

Format the timestamp so that it can be used in mysql queries

Return Value

string The formatted time

at line line 50
static TimeDate fromMysql(string $time)

Create a timestamp from a MySQL string

Parameters

string $time

Return Value

TimeDate

at line line 60
static TimeDate from(string|DateTime $time)

Create a timestamp from a string or another object

Parameters

string|DateTime $time

Return Value

TimeDate

at line line 75
static TimeDate now(DateTimeZone|string $timezone = null)

Get a Carbon instance for the current date and time

Parameters

DateTimeZone|string $timezone

Return Value

TimeDate