ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
TimeStamp.php
Go to the documentation of this file.
1 <?php
2 
4 
7 use Sabre\Xml;
8 
18 class TimeStamp extends Text {
19 
26  public $delimiter = null;
27 
36  function getValueType() {
37 
38  return 'TIMESTAMP';
39 
40  }
41 
49  function getJsonValue() {
50 
52 
53  $dateStr =
54  $parts['year'] . '-' .
55  $parts['month'] . '-' .
56  $parts['date'] . 'T' .
57  $parts['hour'] . ':' .
58  $parts['minute'] . ':' .
59  $parts['second'];
60 
61  // Timezone
62  if (!is_null($parts['timezone'])) {
63  $dateStr .= $parts['timezone'];
64  }
65 
66  return [$dateStr];
67 
68  }
69 
78  protected function xmlSerializeValue(Xml\Writer $writer) {
79 
80  // xCard is the only XML and JSON format that has the same date and time
81  // format than vCard.
82  $valueType = strtolower($this->getValueType());
83  $writer->writeElement($valueType, $this->getValue());
84 
85  }
86 }
iCalendar/vCard/jCal/jCard/xCal/xCard writer object.
Definition: Writer.php:17
getValueType()
Returns the type of value.
Definition: TimeStamp.php:36
getJsonValue()
Returns the value, in the format it should be encoded for json.
Definition: TimeStamp.php:49
xmlSerializeValue(Xml\Writer $writer)
This method serializes only the value of a property.
Definition: TimeStamp.php:78
Text property.
Definition: Text.php:20
getValue()
Returns the current value.
Definition: Property.php:115
static parseVCardDateTime($date)
This method parses a vCard date and or time value.