public function setDateTime(DateTimeInterface $dt)
    {
        $tz = $dt->getTimeZone();
        $isUtc = in_array($tz->getName(), ['UTC', 'GMT', 'Z']);

        if ($isUtc) {
            $value = $dt->format('Ymd\\THis\\Z');
        } else {
            // Calculating the offset.
            $value = $dt->format('Ymd\\THisO');
        }

        $this->value = $value;
    }
public function setDateTime(DateTimeInterface $dt)
    {
        $tz = $dt->getTimeZone();
        $isUtc = in_array($tz->getName(), ['UTC', 'GMT', 'Z']);

        if ($isUtc) {
            $value = $dt->format('Ymd\\THis\\Z');
        } else {
            // Calculating the offset.
            $value = $dt->format('Ymd\\THisO');
        }

        $this->value = $value;
    }
public function setDateTime ( DateTimeInterface $ dt ) { $ tz = $ dt -> getTimeZone ( ) ; $ isUtc = in_array ( $ tz -> getName ( ) , [ 'UTC' , 'GMT' , 'Z' ] ) ; if ( $ isUtc ) { $ value = $ dt -> format ( 'Ymd\\THis\\Z' ) ; } else { // Calculating the offset. $ value = $ dt -> format ( 'Ymd\\THisO' ) ; } $ this -> value = $ value ; }
Sets the property as a DateTime object.

@param DateTimeInterface $dt
Sets the property as a DateTime object .