ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilDclDatetimeRecordRepresentation.php
Go to the documentation of this file.
1 <?php
2 
10 {
11 
19  public function getHTML($link = true)
20  {
21  global $DIC;
22  $ilUser = $DIC['ilUser'];
23 
24  $value = $this->getRecordField()->getValue();
25  if ($value == '0000-00-00 00:00:00' or !$value) {
26  return $this->lng->txt('no_date');
27  }
28  return $this->formatDate($value, $ilUser->getDateFormat());
29  }
30 
37  protected function formatDate($value, $format)
38  {
39  $timestamp = strtotime($value);
40  switch ($format) {
42  return date("d.m.Y", $timestamp);
44  return date("Y-m-d", $timestamp);
46  return date("m/d/Y", $timestamp);
47  }
48  return $this->lng->txt('no_date');
49  }
50 
51 
59  public function parseFormInput($value)
60  {
61  if (!$value || $value == "-") {
62  return null;
63  }
64  return substr($value, 0, -9);
65  }
66 }
parseFormInput($value)
function parses stored value to the variable needed to fill into the form for editing.
$format
Definition: metadata.php:141
global $DIC
Definition: saml.php:7
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
$ilUser
Definition: imgupload.php:18
getHTML($link=true)
Outputs html of a certain field.
Class ilDclBaseRecordRepresentation.
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:81
Class ilDclDateTimeRecordRepresentation.