Time::from()

Object instantiator.

Table of Contents
  1. Description
  2. Example

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::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::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.