Time
class Time extends DateTime
Extension of the PHP DateTime class.
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 new Time object according to the specified date.
Returns new Time object according to the specified timestamp.
Returns new Time object according to the specified DOS timestamp.
Returns new Time object formatted according to the specified format.
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 73
__construct(string $time = 'now', string|DateTimeZone|null $timeZone = null)
Constructor.
at line 89
static Time
now(string|DateTimeZone|null $timeZone = null)
Returns a new Time object.
at line 103
static Time
createFromDate(int $year, int|null $month = null, int|null $day = null, string|DateTimeZone|null $timeZone = null)
Returns new Time object according to the specified date.
at line 121
static Time
createFromTimestamp(int $timestamp, string|DateTimeZone|null $timeZone = null)
Returns new Time object according to the specified timestamp.
at line 137
static Time
createFromDOSTimestamp(int $timestamp, string|DateTimeZone|null $timeZone = null)
Returns new Time object according to the specified DOS timestamp.
at line 159
static Time
createFromFormat(string $format, string $time, string|DateTimeZone|null $timeZone = null)
Returns new Time object formatted according to the specified format.
at line 184
Time
setTimezone(string|DateTimeZone $timeZone)
Sets the time zone for the Time object.
at line 200
Time
forward(int $seconds)
Move forward in time by x seconds.
at line 211
Time
rewind(int $seconds)
Move backward in time by x seconds.
at line 221
int
getDOSTimestamp()
Returns the DOS timestamp.
at line 243
bool
isLeapYear()
Returns TRUE if the year is a leap year and FALSE if not.
at line 260
array
daysInMonths()
Returns an array containing the number of days in each month of the year.
at line 284
int
daysInMonth()
Returns the number of days in the current or specified month.
at line 295
string
formatLocalized(string $format)
Returns a formatted date string according to current locale settings.