Time::__invoke()

Proxy for the current object, called as a function.

Table of Contents
  1. Description
  2. Example

Description

Time::__invoke(string $pattern = '%Y-%m-%d %T'): string;

This method will be called when a Time instance is called as a function. Calling this method will pass it to Time::i().

Example

$time = new Time;

echo $time('%Y-%m-%d'); // Returns `'2026-04-18'`

Time::__invoke()

Proxy for the current object, called as a function.

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::i()

Returns the date/time formatted according to the given pattern.

Time::name()

Returns the date/time format as a valid file name.

Time::to()

Converts current date/time zone to other date/time zone.