aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/XMLRPCDateParameter.php
blob: 39a849fe27990368f9151095550b3ad2af4050f9 (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
<?php
/**
 * @class XMLRPCDateParameter An ISO8601 data and time.
 */
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>";
	}
}