src/Filter/DateTime.php
public static function format(DateTimeInterface $dateTime, string $format = 'c') : string
    {
        if (empty(trim($format))) {
            throw new \InvalidArgumentException('$format is not a non-empty string');
        }

        return $dateTime->format($format);
    }
public static function format(DateTimeInterface $dateTime, string $format = 'c') : string
    {
        if (empty(trim($format))) {
            throw new \InvalidArgumentException('$format is not a non-empty string');
        }

        return $dateTime->format($format);
    }
public static function format ( DateTimeInterface $ dateTime , string $ format = 'c' ) : string { if ( empty ( trim ( $ format ) ) ) { throw new \ InvalidArgumentException ( '$format is not a non-empty string' ) ; } return $ dateTime -> format ( $ format ) ; }
Filters the give \DateTime object to a formatted string.

@param DateTimeInterface $dateTime The date to be formatted.
@param string            $format   The format of the outputted date string.

@return string

@throws \InvalidArgumentException Thrown if $format is not a string
Filters the give \ DateTime object to a formatted string .