PHP Class Neos\Eel\Helper\DateHelper

Inheritance: implements Neos\Eel\ProtectedContextAwareInterface
Datei anzeigen Open project: neos/flow-development-collection Class Usage Examples

Public Methods

Method 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 method

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
return DateTime

allowsCallOfMethod() public method

All methods are considered safe
public allowsCallOfMethod ( string $methodName ) : boolean
$methodName string
return boolean

dayOfMonth() public method

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

diff() public method

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

format() public method

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

hour() public method

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

minute() public method

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

month() public method

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

now() public method

Examples:: Date.now().timestamp
public now ( ) : DateTime
return DateTime

parse() public method

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

second() public method

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

subtract() public method

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
return DateTime

today() public method

Get the current date
public today ( ) : DateTime
return DateTime

year() public method

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