TimeInterface
interface TimeInterface implements DateTimeInterface
Time interface.
Constants
MINUTE |
Number of seconds in a minute. |
HOUR |
Number of seconds in an hour. |
DAY |
Number of seconds in a day. |
WEEK |
Number of seconds in a week. |
MONTH |
Average number of seconds in a month. |
YEAR |
Average number of seconds in a year. |
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 a copy of the current instance.
Move forward in time by x seconds.
Move backward in time by x seconds.
Returns the DOS timestamp.
Returns TRUE if the year is a leap year and FALSE if not.
Returns an array containing the number of days in each month of the year.
Returns the number of days in the current or specified month.
Returns a formatted date string according to current locale settings.
Details
at line 65
static TimeInterface
now(DateTimeZone|string|null $timeZone = null)
Returns a new instance set to the current time.
at line 76
static false|TimeInterface
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.
at line 85
static false|TimeInterface
createFromTimestamp(int $timestamp, DateTimeZone|string|null $timeZone = null)
Returns a new instance according to the specified UNIX timestamp.
at line 94
static false|TimeInterface
createFromDOSTimestamp(int $timestamp, DateTimeZone|string|null $timeZone = null)
Returns a new instance according to the specified DOS timestamp.
at line 104
static false|TimeInterface
createFromFormat(string $format, string $time, DateTimeZone|string|null $timeZone = null)
Returns a new instance according to the specified time string.
at line 111
$this
copy()
Returns a copy of the current instance.
at line 119
$this|false|TimeInterface
setTimezone(DateTimeZone|string $timeZone)
Sets the time zone.
at line 127
$this|false|TimeInterface
forward(int $seconds)
Move forward in time by x seconds.
at line 135
$this|false|TimeInterface
rewind(int $seconds)
Move backward in time by x seconds.
at line 142
int
getDOSTimestamp()
Returns the DOS timestamp.
at line 149
bool
isLeapYear()
Returns TRUE if the year is a leap year and FALSE if not.
at line 156
array
daysInMonths()
Returns an array containing the number of days in each month of the year.
at line 163
int
daysInMonth()
Returns the number of days in the current or specified month.
at line 171
string
formatLocalized(string $format)
Returns a formatted date string according to current locale settings.