public function setDate($date = null)
    {
        if ($this->_date === null) {
            if ($date === null) {
                $date = date('r');
            } else if (is_int($date)) {
                $date = date('r', $date);
            } else if (is_string($date)) {
                $date = strtotime($date);
                if ($date === false || $date < 0) {
                    /**
                     * @see Zend_Mail_Exception
                     */
                    // require_once 'Zend/Mail/Exception.php';
                    throw new Zend_Mail_Exception('String representations of Date Header must be ' .
                                                  'strtotime()-compatible');
                }
                $date = date('r', $date);
            } else if ($date instanceof Zend_Date) {
                $date = $date->get(Zend_Date::RFC_2822);
            } else {
                /**
                 * @see Zend_Mail_Exception
                 */
                // require_once 'Zend/Mail/Exception.php';
                throw new Zend_Mail_Exception(__METHOD__ . ' only accepts UNIX timestamps, Zend_Date objects, ' .
                                              ' and strtotime()-compatible strings');
            }
            $this->_date = $date;
            $this->_storeHeader('Date', $date);
        } else {
            /**
             * @see Zend_Mail_Exception
             */
            // require_once 'Zend/Mail/Exception.php';
            throw new Zend_Mail_Exception('Date Header set twice');
        }
        return $this;
    }
public function setDate($date = null)
    {
        if ($this->_date === null) {
            if ($date === null) {
                $date = date('r');
            } else if (is_int($date)) {
                $date = date('r', $date);
            } else if (is_string($date)) {
                $date = strtotime($date);
                if ($date === false || $date < 0) {
                    /**
                     * @see Zend_Mail_Exception
                     */
                    // require_once 'Zend/Mail/Exception.php';
                    throw new Zend_Mail_Exception('String representations of Date Header must be ' .
                                                  'strtotime()-compatible');
                }
                $date = date('r', $date);
            } else if ($date instanceof Zend_Date) {
                $date = $date->get(Zend_Date::RFC_2822);
            } else {
                /**
                 * @see Zend_Mail_Exception
                 */
                // require_once 'Zend/Mail/Exception.php';
                throw new Zend_Mail_Exception(__METHOD__ . ' only accepts UNIX timestamps, Zend_Date objects, ' .
                                              ' and strtotime()-compatible strings');
            }
            $this->_date = $date;
            $this->_storeHeader('Date', $date);
        } else {
            /**
             * @see Zend_Mail_Exception
             */
            // require_once 'Zend/Mail/Exception.php';
            throw new Zend_Mail_Exception('Date Header set twice');
        }
        return $this;
    }
public function setDate ( $ date = null ) { if ( $ this -> _date === null ) { if ( $ date === null ) { $ date = date ( 'r' ) ; } else if ( is_int ( $ date ) ) { $ date = date ( 'r' , $ date ) ; } else if ( is_string ( $ date ) ) { $ date = strtotime ( $ date ) ; if ( $ date === false || $ date < 0 ) { /**
                     * @see Zend_Mail_Exception
                     */ // require_once 'Zend/Mail/Exception.php'; throw new Zend_Mail_Exception ( 'String representations of Date Header must be ' . 'strtotime()-compatible' ) ; } $ date = date ( 'r' , $ date ) ; } else if ( $ date instanceof Zend_Date ) { $ date = $ date -> get ( Zend_Date :: RFC_2822 ) ; } else { /**
                 * @see Zend_Mail_Exception
                 */ // require_once 'Zend/Mail/Exception.php'; throw new Zend_Mail_Exception ( __METHOD__ . ' only accepts UNIX timestamps, Zend_Date objects, ' . ' and strtotime()-compatible strings' ) ; } $ this -> _date = $ date ; $ this -> _storeHeader ( 'Date' , $ date ) ; } else { /**
             * @see Zend_Mail_Exception
             */ // require_once 'Zend/Mail/Exception.php'; throw new Zend_Mail_Exception ( 'Date Header set twice' ) ; } return $ this ; }
Sets Date-header

@param  timestamp|string|Zend_Date $date
@return Zend_Mail Provides fluent interface
@throws Zend_Mail_Exception if called subsequent times or wrong date format.
Sets Date - header