Exemplo n.º 1
0
 /**
  * Converts input value/key to a valid timestamp
  * @return int Returns timestamp if value is a valid datetime string or null if there was an error
  */
 public function timestampVal($key)
 {
     if (!isset($this->_date)) {
         $this->_date = Raxan::CDate();
     }
     $v = $this->value($key);
     if (!is_array($v)) {
         try {
             $v = $v ? $this->_date->getTimestamp($v) : null;
         } catch (Exception $e) {
             $v = null;
         }
     } else {
         foreach ($v as $k => $b) {
             try {
                 $b = $b ? $this->_date->getTimestamp($b) : null;
             } catch (Exception $e) {
                 $b = null;
             }
             $v[$k] = $b;
         }
     }
     return $v;
 }