aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/XMLRPCDateParameter.php
blob: bb39167fc8025fe72962d99aaf9027fab060b6f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
/**
 * @class XMLRPCDateParameter An ISO8601 data and time.
 * @author Curverider Ltd
 */
class XMLRPCDateParameter extends XMLRPCParameter
{
	/**
	 * Construct a date
	 *
	 * @param int $timestamp The unix timestamp, or blank for "now".
	 */
	function __construct($timestamp = 0)
	{
		parent::__construct();
		
		$this->value = $timestamp;
		if (!$timestamp)
			$this->value = time(); 
	}
	
	function __toString() 
	{
		$value = date('c', $this->value);
		return "<value><dateTime.iso8601>{$value}</dateTime.iso8601></value>";
	}
}