Example #1
0
 /**
  * convert from current user format to iso datetime
  */
 protected function humandatetimeToIso($humandatetime)
 {
     $datetime = \dateTime::createFromFormat($this->format, $humandatetime);
     if (!$datetime) {
         return '';
     }
     $timestamp = $datetime->getTimestamp();
     if ($timestamp < 1) {
         return "";
     }
     $humandatetime = date($this->store_as, $timestamp);
     return $humandatetime;
 }
Example #2
0
 public function setWith($value, $checkType = true)
 {
     $phpDate = \dateTime::createFromFormat(self::mysqlDateTimeFormat, $value);
     if ($phpDate !== false) {
         parent::setWith($phpDate, $checkType);
     } else {
         parent::setWith($value, false);
         if ($checkType === true) {
             $this->fail($this->_('%s is not in format Y-m-d H:i:s', $this));
         }
     }
     return $this;
 }