makeFromTime() public static method

Make and return a new ExpressiveDate instance with defined hour, minute, and second.
public static makeFromTime ( integer $hour = null, integer $minute = null, integer $second = null, string | DateTimeZone $timezone = null ) : ExpressiveDate
$hour integer
$minute integer
$second integer
$timezone string | DateTimeZone
return ExpressiveDate
Beispiel #1
0
 public function testDateIsCreatedFromTime()
 {
     $date = ExpressiveDate::makeFromTime(20, null, null);
     $this->assertEquals('20:00:00', $date->getTime());
     $date = ExpressiveDate::makeFromTime(-12, null, 120);
     $this->assertEquals('12:02:00', $date->getTime());
     $date = ExpressiveDate::makeFromTime(12, 30, 125);
     $this->assertEquals('12:32:05', $date->getTime());
 }