1: <?php
2: /**
3: * An ISO8601 data and time.
4: *
5: * @package Elgg.Core
6: * @subpackage XMLRPC
7: */
8: class XMLRPCDateParameter extends XMLRPCParameter {
9: /**
10: * Construct a date
11: *
12: * @param int $timestamp The unix timestamp, or blank for "now".
13: */
14: function __construct($timestamp = 0) {
15: parent::__construct();
16:
17: $this->value = $timestamp;
18:
19: if (!$timestamp) {
20: $this->value = time();
21: }
22: }
23:
24: /**
25: * Convert to string
26: *
27: * @return string
28: */
29: function __toString() {
30: $value = date('c', $this->value);
31: return "<value><dateTime.iso8601>{$value}</dateTime.iso8601></value>";
32: }
33: }
34: