Пример #1
0
 public function testEarlierThan()
 {
     $object1 = TimeOfDay::create(10, 2, 6);
     $object2 = TimeOfDay::createFromDateTime(new DateTime('10:02:05'));
     static::assertFalse($object1->earlierThan($object2));
     $object1 = TimeOfDay::create(10, 2, 5);
     $object2 = TimeOfDay::createFromDateTime(new DateTime('10:02:05'));
     static::assertFalse($object1->earlierThan($object2));
     $object1 = TimeOfDay::create(10, 2, 4);
     $object2 = TimeOfDay::createFromDateTime(new DateTime('10:02:05'));
     static::assertTrue($object1->earlierThan($object2));
 }
Пример #2
0
 /**
  * @param DateTimeInterface $dateTime
  *
  * @return self
  */
 public static function createFromDateTime(DateTimeInterface $dateTime)
 {
     return static::create(Date::createFromDateTime($dateTime), TimeOfDay::createFromDateTime($dateTime));
 }