PHP Class PHPDaemon\Utils\DateTime

Inheritance: extends DateTime
Show file Open project: kakserpom/phpdaemon Class Usage Examples

Public Methods

Method Description
__construct ( string $time = 'now', DateTimeZone $timezone = null ) Support timestamp and available date format
diffAsText ( integer | string | DateTimeInterface $datetime1, integer | string | DateTimeInterface $datetime2, boolean $absolute = false ) : string Calculates a difference between two dates

Method Details

__construct() public method

Support timestamp and available date format
public __construct ( string $time = 'now', DateTimeZone $timezone = null )
$time string
$timezone DateTimeZone

diffAsText() public static method

Calculates a difference between two dates
See also: http://www.php.net/manual/en/datetime.diff.php
public static diffAsText ( integer | string | DateTimeInterface $datetime1, integer | string | DateTimeInterface $datetime2, boolean $absolute = false ) : string
$datetime1 integer | string | DateTimeInterface
$datetime2 integer | string | DateTimeInterface
$absolute boolean
return string Something like this: 1 year. 2 mon. 6 day. 4 hours. 21 min. 10 sec.