Ouzo\Utilities\Date::modifyNow PHP Method

modifyNow() public static method

Modifies the current time and returns a formatted date.
public static modifyNow ( string $interval, string $format = self::DEFAULT_TIME_FORMAT ) : string
$interval string
$format string
return string
    public static function modifyNow($interval, $format = self::DEFAULT_TIME_FORMAT)
    {
        return Clock::now()->toDateTime()->modify($interval)->format($format);
    }

Usage Example

Beispiel #1
0
 /**
  * @test
  */
 public function shouldModifyCurrentDate()
 {
     //when
     $date = Date::modifyNow('2 days');
     //then
     $this->assertGreaterThan(Clock::nowAsString(), $date);
 }