Elgg  Version 5.1
date.php
Go to the documentation of this file.
1 <?php
10 
11 $format = elgg_extract('format', $vars, elgg_get_config('date_format', elgg_echo('input:date_format')), false);
12 
14 if (!$value) {
15  return;
16 }
17 
18 try {
20 
22  'datetime' => $dt->format('c'),
23  ];
24 
25  echo elgg_format_element('time', $attributes, $dt->formatLocale($format));
26 } catch (DataFormatException $ex) {
27  // $value is not a valid datetime, no output
28  return;
29 }
$format
Definition: date.php:37
elgg_get_config(string $name, $default=null)
Get an Elgg configuration value.
$attributes
Definition: date.php:21
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
$value
Definition: date.php:41
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:254
$vars['class']
Definition: date.php:23
$dt
Definition: time.php:70
An exception thrown when there is a problem in the format of some data.
static normalizeTime($time)
Returns DateTime object based on time representation.
Definition: Values.php:75
elgg_format_element(string $tag_name, array $attributes=[], string $text= '', array $options=[])
Format an HTML element.
Definition: output.php:145