public static function isDateString($value, $name)
    {
        Validate::canCastAsString($value, 'value');

        try {
            new \DateTime($value);
            return true;
        } catch (\Exception $e) {
            throw new \InvalidArgumentException(
                sprintf(
                    Resources::ERROR_INVALID_DATE_STRING,
                    $name,
                    $value
                )
            );
        }
    }
public static function isDateString($value, $name)
    {
        Validate::canCastAsString($value, 'value');

        try {
            new \DateTime($value);
            return true;
        } catch (\Exception $e) {
            throw new \InvalidArgumentException(
                sprintf(
                    Resources::ERROR_INVALID_DATE_STRING,
                    $name,
                    $value
                )
            );
        }
    }
public static function isDateString ( $ value , $ name ) { Validate :: canCastAsString ( $ value , 'value' ) ; try { new \ DateTime ( $ value ) ; return true ; } catch ( \ Exception $ e ) { throw new \ InvalidArgumentException ( sprintf ( Resources :: ERROR_INVALID_DATE_STRING , $ name , $ value ) ) ; } }
Validate if string is date formatted

@param string $value Value to validate
@param string $name  Name of parameter to insert in erro message

@throws \InvalidArgumentException

@return boolean
Validate if string is date formatted