public function setValue($p_value) { if (!MetaDate::IsValid($p_value)) { throw new InvalidValueException($p_value, MetaDate::GetTypeName()); } $this->m_value = trim($p_value); list($this->m_year, $this->m_month, $this->m_monthDay) = preg_split('/-/', $this->m_value); $timestamp = strtotime($this->m_value); $date_time = getdate($timestamp); $this->m_weekDay = $date_time['wday']; }
public static function IsValid($p_value) { $p_value = trim($p_value); // now() is an value which have to be computed if (strtolower($p_value) == 'now()') { return true; } $datetimeParts = preg_split('/[\\s]+/', $p_value); $date = $datetimeParts[0]; $time = isset($datetimeParts[1]) ? $datetimeParts[1] : '00:00:00'; if (!MetaDate::IsValid($date)) { return false; } if (!MetaTime::IsValid($time)) { return false; } return true; }