ILIAS  release_8 Revision v8.24
class.ilDclDatetimeRecordRepresentation.php
Go to the documentation of this file.
1<?php
2
20{
24 public function getHTML(bool $link = true, array $options = []): string
25 {
26 $value = $this->getRecordField()->getValue();
27 if ($value == '0000-00-00 00:00:00' || !$value) {
28 return $this->lng->txt('no_date');
29 }
30
31 return $this->formatDate($value, $this->user->getDateFormat());
32 }
33
37 protected function formatDate(string $value, string $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
49 return $this->lng->txt('no_date');
50 }
51
56 public function parseFormInput($value): ?string
57 {
58 if (!$value || $value == "-") {
59 return null;
60 }
61
62 return substr($value, 0, -9);
63 }
64}
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:70
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getHTML(bool $link=true, array $options=[])
Outputs html of a certain field.
parseFormInput($value)
function parses stored value to the variable needed to fill into the form for editing.
$format
Definition: metadata.php:235