PHP Класс Neos\Eel\Helper\DateHelper

Наследование: implements Neos\Eel\ProtectedContextAwareInterface
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
add ( DateTime $date, string | DateInterval $interval ) : DateTime Add an interval to a date and return a new DateTime object
allowsCallOfMethod ( string $methodName ) : boolean All methods are considered safe
dayOfMonth ( DateTimeInterface $dateTime ) : integer Get the day of month of a date
diff ( DateTime $dateA, DateTime $dateB ) : DateInterval Get the difference between two dates as a \DateInterval object
format ( integer | string | DateTime | DateInterval $date, string $format ) : string Format a date (or interval) to a string with a given format
hour ( DateTimeInterface $dateTime ) : integer Get the hour of a date (24 hour format)
minute ( DateTimeInterface $dateTime ) : integer Get the minute of a date
month ( DateTimeInterface $dateTime ) : integer Get the month of a date
now ( ) : DateTime Get the current date and time
parse ( string $string, string $format ) : DateTime Parse a date from string with a format to a DateTime object
second ( DateTimeInterface $dateTime ) : integer Get the second of a date
subtract ( DateTime $date, string | DateInterval $interval ) : DateTime Subtract an interval from a date and return a new DateTime object
today ( ) : DateTime Get the current date
year ( DateTimeInterface $dateTime ) : integer Get the year of a date

Описание методов

add() публичный Метод

Add an interval to a date and return a new DateTime object
public add ( DateTime $date, string | DateInterval $interval ) : DateTime
$date DateTime
$interval string | DateInterval
Результат DateTime

allowsCallOfMethod() публичный Метод

All methods are considered safe
public allowsCallOfMethod ( string $methodName ) : boolean
$methodName string
Результат boolean

dayOfMonth() публичный Метод

Get the day of month of a date
public dayOfMonth ( DateTimeInterface $dateTime ) : integer
$dateTime DateTimeInterface
Результат integer The day of month of the given date

diff() публичный Метод

Get the difference between two dates as a \DateInterval object
public diff ( DateTime $dateA, DateTime $dateB ) : DateInterval
$dateA DateTime
$dateB DateTime
Результат DateInterval

format() публичный Метод

See formatting options as in PHP date()
public format ( integer | string | DateTime | DateInterval $date, string $format ) : string
$date integer | string | DateTime | DateInterval
$format string
Результат string

hour() публичный Метод

Get the hour of a date (24 hour format)
public hour ( DateTimeInterface $dateTime ) : integer
$dateTime DateTimeInterface
Результат integer The hour of the given date

minute() публичный Метод

Get the minute of a date
public minute ( DateTimeInterface $dateTime ) : integer
$dateTime DateTimeInterface
Результат integer The minute of the given date

month() публичный Метод

Get the month of a date
public month ( DateTimeInterface $dateTime ) : integer
$dateTime DateTimeInterface
Результат integer The month of the given date

now() публичный Метод

Examples:: Date.now().timestamp
public now ( ) : DateTime
Результат DateTime

parse() публичный Метод

Parse a date from string with a format to a DateTime object
public parse ( string $string, string $format ) : DateTime
$string string
$format string
Результат DateTime

second() публичный Метод

Get the second of a date
public second ( DateTimeInterface $dateTime ) : integer
$dateTime DateTimeInterface
Результат integer The second of the given date

subtract() публичный Метод

Subtract an interval from a date and return a new DateTime object
public subtract ( DateTime $date, string | DateInterval $interval ) : DateTime
$date DateTime
$interval string | DateInterval
Результат DateTime

today() публичный Метод

Get the current date
public today ( ) : DateTime
Результат DateTime

year() публичный Метод

Get the year of a date
public year ( DateTimeInterface $dateTime ) : integer
$dateTime DateTimeInterface
Результат integer The year of the given date