Time
class Time extends DateTime implements TimeInterface
Extension of the PHP DateTime class.
Traits
Methods
Returns a new instance according to the specified date.
Returns a new instance according to the specified UNIX timestamp.
Returns a new instance according to the specified DOS timestamp.
Returns a new instance according to the specified time string.
Returns an array containing the number of days in each month of the year.
Returns a formatted date string according to current locale settings.
Returns a copy of the current instance.
Returns an immutable instance of the current instance.
Details
in TimeTrait at line 28
__construct(string $time = 'now', DateTimeZone|string|null $timeZone = null)
Constructor.
in TimeTrait at line 44
static TimeTrait
now(DateTimeZone|string|null $timeZone = null)
Returns a new instance set to the current time.
in TimeTrait at line 58
static false|TimeTrait
createFromDate(int $year, int|null $month = null, int|null $day = null, DateTimeZone|string|null $timeZone = null)
Returns a new instance according to the specified date.
in TimeTrait at line 76
static false|TimeTrait
createFromTimestamp(int $timestamp, DateTimeZone|string|null $timeZone = null)
Returns a new instance according to the specified UNIX timestamp.
in TimeTrait at line 88
static false|TimeTrait
createFromDOSTimestamp(int $timestamp, DateTimeZone|string|null $timeZone = null)
Returns a new instance according to the specified DOS timestamp.
in TimeTrait at line 110
static false|TimeTrait
createFromFormat(string $format, string $time, DateTimeZone|string|null $timeZone = null)
Returns a new instance according to the specified time string.
in TimeTrait at line 135
$this|false|TimeTrait
setTimezone(DateTimeZone|string $timeZone)
Sets the time zone.
in TimeTrait at line 151
$this|false|TimeTrait
forward(int $seconds)
Move forward in time by x seconds.
in TimeTrait at line 162
$this|false|TimeTrait
rewind(int $seconds)
Move backward in time by x seconds.
in TimeTrait at line 172
int
getDOSTimestamp()
Returns the DOS timestamp.
in TimeTrait at line 194
bool
isLeapYear()
Returns TRUE if the year is a leap year and FALSE if not.
in TimeTrait at line 211
array
daysInMonths()
Returns an array containing the number of days in each month of the year.
in TimeTrait at line 235
int
daysInMonth()
Returns the number of days in the current or specified month.
in TimeTrait at line 246
string
formatLocalized(string $format)
Returns a formatted date string according to current locale settings.
at line 27
$this
copy()
Returns a copy of the current instance.
at line 37
TimeImmutable
getImmutable()
Returns an immutable instance of the current instance.