Time::__toString()

Proxy for the current object, casted as a string.

Table of Contents
  1. Description
  2. Example

Description

Time::__toString(): string;

This method will be called when you cast a Time instance as a string. This method returns the source property value which is a unit of time in Y-m-d H:i:s format.

Example

$time = new Time;

echo $time; // Returns `'2026-04-16 17:52:00'`

Time::__toString()

Proxy for the current object, casted as a string.

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.