[ Index ] |
|
Code source de Joomla 1.0.13 |
1 <?php 2 //******************************************************************* 3 //iso8601 datetime class 4 //******************************************************************* 5 //by John Heinstein 6 //johnkarl@nbnet.nb.ca 7 //******************************************************************* 8 //Version 0.1 9 //copyright 2004 Engage Interactive 10 //http://www.engageinteractive.com/dom_xmlrpc/ 11 //All rights reserved 12 //******************************************************************* 13 //Licensed under the GNU General Public License (GPL) 14 //http://www.gnu.org/copyleft/gpl.html 15 //******************************************************************* 16 17 class dom_xmlrpc_datetime_iso8601 { 18 var $year; var $month; var $day; 19 var $hour; var $minute; var $second; 20 21 function dom_xmlrpc_datetime_iso8601($datetime) { 22 if (is_int($datetime)) { 23 $this->fromDateTime_php($datetime); 24 } 25 else { 26 $this->fromDateTime_iso($datetime); 27 } 28 } //dom_xmlrpc_datetime_iso8601 29 30 function phpToISO(&$phpDate) { 31 return (date('Y', $phpDate) . date('m', $phpDate) . date('d', $phpDate) . 32 'T'. date('H', $phpDate). ':' . date('i', $phpDate) . ':' . date('s', $phpDate)); 33 } //phpToISO 34 35 function fromDateTime_php($phpdatetime) { 36 //input php date time 37 $this->year = date('Y', $phpdatetime); 38 $this->month = date('m', $phpdatetime); 39 $this->day = date('d', $phpdatetime); 40 $this->hour = date('H', $phpdatetime); 41 $this->minute = date('i', $phpdatetime); 42 $this->second = date('s', $phpdatetime); 43 } //fromDateTime_php 44 45 function fromDateTime_iso($isoFormattedString) { 46 //input iso date time 47 $this->year = substr($isoFormattedString, 0, 4); 48 $this->month = substr($isoFormattedString, 4, 2); 49 $this->day = substr($isoFormattedString, 6, 2); 50 $this->hour = substr($isoFormattedString, 9, 2); 51 $this->minute = substr($isoFormattedString, 12, 2); 52 $this->second = substr($isoFormattedString, 15, 2); 53 } //fromDateTime_iso 54 55 function getDateTime_iso() { 56 //return iso date time 57 return ($this->year . $this->month . $this->day . 58 'T'. $this->hour . ':' . $this->minute . ':' . $this->second); 59 } //getDateTime_iso 60 61 function getDateTime_php() { 62 //return php date time 63 return mktime($this->hour, $this->minute, $this->second, $this->month, $this->day, $this->year); 64 } //getDateTime_php 65 } //dom_xmlrpc_datetime_iso8601 66 67 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 14:43:32 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |