CoreFiles by mySites.guru
dom_xmlrpc_datetime_iso8601.php67 lines, 2,318 bytes, from Joomla_1.0.13-Stable-Full_Package.zip
Raw History Compare with 1.0.12
md5
432ace5882b5ca21064d554e8f4ed930
sha1
ad6d19bc9c2655a846051f6b92b9eef1ea0f1885
sha256
cca5d27476ff679f814ed984f4270083a50e2ca719ca61de2905f14578721b17
<?php
//*******************************************************************
//iso8601 datetime class
//*******************************************************************
//by John Heinstein
//[email protected]
//*******************************************************************
//Version 0.1
//copyright 2004 Engage Interactive
//http://www.engageinteractive.com/dom_xmlrpc/
//All rights reserved
//*******************************************************************
//Licensed under the GNU General Public License (GPL)
//http://www.gnu.org/copyleft/gpl.html
//*******************************************************************

class dom_xmlrpc_datetime_iso8601 {
	var $year;  var $month; var $day;
	var $hour; var $minute; var $second;

	function dom_xmlrpc_datetime_iso8601($datetime) {
		if (is_int($datetime)) {
			$this->fromDateTime_php($datetime);
		}
		else {
			$this->fromDateTime_iso($datetime);
		}
	} //dom_xmlrpc_datetime_iso8601

	function phpToISO(&$phpDate) {
		return (date('Y', $phpDate) . date('m', $phpDate) . date('d', $phpDate) .
					'T'. date('H', $phpDate). ':' . date('i', $phpDate) . ':' . date('s', $phpDate));
	} //phpToISO

	function fromDateTime_php($phpdatetime) {
		//input php date time
		$this->year = date('Y', $phpdatetime);
		$this->month = date('m', $phpdatetime);
		$this->day = date('d', $phpdatetime);
		$this->hour = date('H', $phpdatetime);
		$this->minute = date('i', $phpdatetime);
		$this->second = date('s', $phpdatetime);
	} //fromDateTime_php

	function fromDateTime_iso($isoFormattedString) {
		//input iso date time
		$this->year = substr($isoFormattedString, 0, 4);
		$this->month = substr($isoFormattedString, 4, 2);
		$this->day = substr($isoFormattedString, 6, 2);
		$this->hour = substr($isoFormattedString, 9, 2);
		$this->minute = substr($isoFormattedString, 12, 2);
		$this->second = substr($isoFormattedString, 15, 2);
	} //fromDateTime_iso

	function getDateTime_iso() {
		//return iso date time
		return ($this->year . $this->month . $this->day .
			'T'. $this->hour . ':' . $this->minute . ':' . $this->second);
	} //getDateTime_iso

	function getDateTime_php() {
		//return php date time
		return mktime($this->hour, $this->minute, $this->second, $this->month, $this->day, $this->year);
	} //getDateTime_php
} //dom_xmlrpc_datetime_iso8601

?>

The same content is in 9 releases, Joomla 1.0.3 to 1.0.13. See them all, or every version of this file.