Zend_Date test
Php
code posted
by
j
created at 01 Oct 19:37
Edit
|
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
/** * Sets a new precision for fractional seconds * * @param integer $precision Precision for the fractional datepart 3 = milliseconds * @throws Zend_Date_Exception * @return Zend_Date Provides fluid interface */ public function setFractionalPrecision($precision) { if (!intval($precision) or ($precision < 0) or ($precision > 9)) { require_once 'Zend/Date/Exception.php'; throw new Zend_Date_Exception("precision ($precision) must be a positive integer less than 10", 0, null, $precision); } $this->_precision = (int) $precision; if ($this->_precision < strlen($this->_fractional)) { $this->_fractional = substr($this->_fractional, 0, $this->_precision); } else { $this->_fractional = str_pad($this->_fractional, $this->_precision, '0', STR_PAD_RIGHT); } return $this; } |
942 Bytes in 2 ms with coderay