public static function getStringValue($dateTime): string
    {
        // do not return anything if no value was specified
        if (!$dateTime) {
            return '';
        }

        // until a mixed type is supported for type-hints, check the value here
        if (!$dateTime instanceof \DateTime) {
            return (new \DateTime($dateTime))->format(static::DATE_FORMAT);
        }

        return $dateTime->format(static::DATE_FORMAT);
    }
public static function getStringValue($dateTime): string
    {
        // do not return anything if no value was specified
        if (!$dateTime) {
            return '';
        }

        // until a mixed type is supported for type-hints, check the value here
        if (!$dateTime instanceof \DateTime) {
            return (new \DateTime($dateTime))->format(static::DATE_FORMAT);
        }

        return $dateTime->format(static::DATE_FORMAT);
    }
public static function getStringValue ( $ dateTime ) : string { // do not return anything if no value was specified if ( ! $ dateTime ) { return '' ; } // until a mixed type is supported for type-hints, check the value here if ( ! $ dateTime instanceof \ DateTime ) { return ( new \ DateTime ( $ dateTime ) ) -> format ( static :: DATE_FORMAT ) ; } return $ dateTime -> format ( static :: DATE_FORMAT ) ; }
Take a \DateTime value and convert it to the string date format that the API expects.

@param \DateTime|mixed $dateTime
@return string
Take a \ DateTime value and convert it to the string date format that the API expects .