PHP Class Neos\Eel\Helper\DateHelper

Inheritance: implements Neos\Eel\ProtectedContextAwareInterface
Afficher le fichier Open project: neos/flow-development-collection Class Usage Examples

Méthodes publiques

Méthode Description
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

Method Details

add() public méthode

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
Résultat DateTime

allowsCallOfMethod() public méthode

All methods are considered safe
public allowsCallOfMethod ( string $methodName ) : boolean
$methodName string
Résultat boolean

dayOfMonth() public méthode

Get the day of month of a date
public dayOfMonth ( DateTimeInterface $dateTime ) : integer
$dateTime DateTimeInterface
Résultat integer The day of month of the given date

diff() public méthode

Get the difference between two dates as a \DateInterval object
public diff ( DateTime $dateA, DateTime $dateB ) : DateInterval
$dateA DateTime
$dateB DateTime
Résultat DateInterval

format() public méthode

See formatting options as in PHP date()
public format ( integer | string | DateTime | DateInterval $date, string $format ) : string
$date integer | string | DateTime | DateInterval
$format string
Résultat string

hour() public méthode

Get the hour of a date (24 hour format)
public hour ( DateTimeInterface $dateTime ) : integer
$dateTime DateTimeInterface
Résultat integer The hour of the given date

minute() public méthode

Get the minute of a date
public minute ( DateTimeInterface $dateTime ) : integer
$dateTime DateTimeInterface
Résultat integer The minute of the given date

month() public méthode

Get the month of a date
public month ( DateTimeInterface $dateTime ) : integer
$dateTime DateTimeInterface
Résultat integer The month of the given date

now() public méthode

Examples:: Date.now().timestamp
public now ( ) : DateTime
Résultat DateTime

parse() public méthode

Parse a date from string with a format to a DateTime object
public parse ( string $string, string $format ) : DateTime
$string string
$format string
Résultat DateTime

second() public méthode

Get the second of a date
public second ( DateTimeInterface $dateTime ) : integer
$dateTime DateTimeInterface
Résultat integer The second of the given date

subtract() public méthode

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
Résultat DateTime

today() public méthode

Get the current date
public today ( ) : DateTime
Résultat DateTime

year() public méthode

Get the year of a date
public year ( DateTimeInterface $dateTime ) : integer
$dateTime DateTimeInterface
Résultat integer The year of the given date