Time::from()
Object instantiator.
Table of Contents
Description
Time::from(...$lot): self;It is just a shortcut for the Time::__construct() way.
Example
$time = Time::from('today');The example above is the same as the instantiation below:
$time = new Time('today');Its purpose is to help you avoid using parentheses when you want to call a method directly from the class instance to minimize variable usage:
// Syntax error, unexpected token “->”, expecting “)”
$year = new Time('today')->year();
// :(
$time = new Time('today');
$year = $time->year();
$year = (new Time('today'))->year(); // :\
$year = Time::from('today')->year(); // :)Time::_()
The dynamic method initiator.
Time::__call()
Proxy for missing methods.
Time::__callStatic()
Proxy for missing static methods.
Time::__construct()
The constructor.
Time::__get()
Proxy for missing properties.
Time::__invoke()
Proxy for the current object, called as a function.
Time::__serialize()
Provides data to be serialized.
Time::__toString()
Proxy for the current object, casted as a string.
Time::__unserialize()
Converts the serialized data back to its object.
Time::date()
Returns the day of the month.
Time::day()
Returns the day number of the week, or the day name.
Time::format()
Returns the date/time formatted according to the given format.
Time::from()
Object instantiator.
Time::hour()
Returns the hour number.
Time::i()
Returns the date/time formatted according to the given pattern.
Time::minute()
Returns the minute number.
Time::month()
Returns the month number, or the month name.
Time::name()
Returns the date/time format as a valid file name.
Time::second()
Returns the second number.
Time::to()
Converts current date/time zone to other date/time zone.
Time::year()
Returns the year number.