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 67
static TimeInterface
now(string|DateTimeZone|null $timeZone = null)
Returns a new instance set to the current time.
at line 78
static TimeInterface|false
createFromDate(int $year, int|null $month = null, int|null $day = null, string|DateTimeZone|null $timeZone = null)
Returns a new instance according to the specified date.
at line 87
static TimeInterface|false
createFromTimestamp(int $timestamp, string|DateTimeZone|null $timeZone = null)
Returns a new instance according to the specified UNIX timestamp.
at line 96
static TimeInterface|false
createFromDOSTimestamp(int $timestamp, string|DateTimeZone|null $timeZone = null)
Returns a new instance according to the specified DOS timestamp.
at line 106
static TimeInterface|false
createFromFormat(string $format, string $time, string|DateTimeZone|null $timeZone = null)
Returns a new instance according to the specified time string.
at line 113
$this
copy()
Returns a copy of the current instance.
at line 121
$this|TimeInterface|false
setTimezone(string|DateTimeZone $timeZone)
Sets the time zone.
at line 129
$this|TimeInterface|false
forward(int $seconds)
Move forward in time by x seconds.
at line 137
$this|TimeInterface|false
rewind(int $seconds)
Move backward in time by x seconds.
at line 144
int
getDOSTimestamp()
Returns the DOS timestamp.
at line 151
bool
isLeapYear()
Returns TRUE if the year is a leap year and FALSE if not.
at line 158
array
daysInMonths()
Returns an array containing the number of days in each month of the year.
at line 165
int
daysInMonth()
Returns the number of days in the current or specified month.
at line 173
string
formatLocalized(string $format)
Returns a formatted date string according to current locale settings.