Time::month()

Returns the month number, or the month name.

Table of Contents
  1. Description
  2. Example

Description

Time::month(?array|string $type = null): mixed;

This method returns the month number, 2 digits with leading zeros. It can also returns the month name if you pass a string or array of strings to the first method argument.

Example

$time = new Time;

echo $time->month(); // Returns `'02'`
echo $time->month(""); // Returns `'February'`
echo $time->month('asdf'); // Returns `'February'`
echo $time->month([
    'April' => 'April',
    'August' => 'Agustus',
    'December' => 'Desember',
    'February' => 'Februari',
    'January' => 'Januari',
    'July' => 'Juli',
    'June' => 'Juni',
    'March' => 'Maret',
    'May' => 'Mei',
    'November' => 'November',
    'October' => 'Oktober',
    'September' => 'September'
]); // Returns `'Februari'`

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

Returns the month number, or the month name.

Time::name()

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

Time::to()

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