public function setDate($date, $format = DATE_FORMAT_ISO)
    {
        $regex = '/^(\d{4})-?(\d{2})-?(\d{2})([T\s]?(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?(Z|[\+\-]\d{2}:?\d{2})?)?$/i';

        if (preg_match($regex, $date, $regs) && $format != DATE_FORMAT_UNIXTIME) {
            $this->year         = $regs[1];
            $this->month        = $regs[2];
            $this->day          = $regs[3];
            $this->hour         = isset($regs[5]) ? $regs[5] : 0;
            $this->minute       = isset($regs[6]) ? $regs[6] : 0;
            $this->second       = isset($regs[7]) ? $regs[7] : 0;
            $this->partsecond   = (float) isset($regs[8]) ? $regs[8] : 0;
        } elseif (is_numeric($date)) {
            // UNIXTIME
            $this->setDate(date('Y-m-d H:i:s', $date));
        } else {
            // unknown format
            $this->year         = 0;
            $this->month        = 1;
            $this->day          = 1;
            $this->hour         = 0;
            $this->minute       = 0;
            $this->second       = 0;
            $this->partsecond   = (float)0;
        }

        return $this;
    }