Time::__get()
Proxy for missing properties.
Table of Contents
Description
Time::__get(string $key): mixed;This method will be called when a public property is not available on class Time. By default, this method will first try to find an existing public method and call it with empty argument. If a virtual method is available and its value is a string containing at least one character %, then it will be passed to the call of Time::i() with the first argument being the value of the virtual method. If the virtual method’s value is a callable function, it will respond in the usual way.
Example
// Create a date/time format for `en` and `id` locale
Time::_('en', '%A, %B %d, %Y');
Time::_('id', '%A, %d %B %Y');
// Create a date/time format for `ru` locale with the usual way
Time::_('ru', function () {
return $this->i('%d.%m.%y');
});
$time = new Time;
$asdf = $time->asdf; // Returns `null` because property `asdf` does not exist
$year = $time->year; // Returns `$time->year()` because method `year()` does exist
$en = $time->en; // Returns `'Monday, June 01, 2026'`
$id = $time->id; // Returns `'Monday, 01 June 2026'`
$ru = $time->ru; // Returns `'01.06.26'`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.