Display the date field

@param \MUtil_Date $value
964347
public function formatDate($value)
    {
        return \MUtil_Html::create(
                'span',
                // array('class' => 'date'),
                \MUtil_Date::format(
                        $value,
                        \Zend_Date::DAY_SHORT . ' ' . \Zend_Date::MONTH_NAME_SHORT . ' ' . \Zend_Date::YEAR,
                        'yyyy-MM-dd'
                        )
                );
    }
665730
static public function toDate($value=null)
    {
        if (!$value) {
            return date('Y-m-d');
        } else {
            if(is_numeric($value)) {
                // strftime format is different from date()
                //$value = strftime('%Y-%m-%d %H:%M:%S', $value);
                $value = strftime('%Y-%m-%d', $value);
            }
            
            return $value;
        }
    }
1365128
protected function dataTransform(&$value)
    {
        if (is_object($value)) {

            // Convert dates to the settings for date_format.
            if (($dateFormat = $this->getSettings()->dateFormat) && $value instanceof \DateTime) {
                $value = $value->format($dateFormat);
            }

            // Handle other objects as needed.
            if (method_exists($this, 'objectHandler')) {
                $value = $this->objectHandler($key, $value);
            }
        }
    }
918643
public function setDateVerified( $value )
	{
		if( $value === $this->getDateVerified() ) { return; }

		$this->_checkDateOnlyFormat( $value );

		$this->_values['vdate'] = ( $value ? (string) $value : null );
		$this->setModified();
	}
617982
public static function calendar($name, $value = null, $options = array())
	{
		static $done;

		if ($done === null)
		{
			$done = array();
		}

		$readonly = isset($options['readonly']) && $options['readonly'] == 'readonly';
		$disabled = isset($options['disabled']) && $options['disabled'] == 'disabled';
		$time     = isset($options['time']) ? (bool)$options['time'] : true;

		$format = 'yy-mm-dd';
		if (isset($options['format']))
		{
			$format = $options['format'] ? $options['format'] : $format;
			unset($options['format']);
		}

		if (!isset($options['class']))
		{
			$options['class'] = 'calendar-field';
		}
		else
		{
			$options['class'] = ' calendar-field';
		}

		if (!$readonly && !$disabled)
		{
			// Load the calendar behavior
			Behavior::calendar();
			Behavior::tooltip();

			$id = self::getIdAttribute($name, $options);

			// Only display the triggers once for each control.
			if (!in_array($id, $done))
			{
				if ($format == 'Y-m-d H:i:s' || $format == '%Y-%m-%d %H:%M:%S')
				{
					$time = true;
				}
				$altformats = array('Y-m-d H:i:s', '%Y-%m-%d %H:%M:%S', 'Y-m-d', '%Y-%m-%d');

				$format = (in_array($format, $altformats) ? 'yy-mm-dd' : $format);

				\App::get('document')->addScriptDeclaration("
					jQuery(document).ready(function($){
						" . ($time ? "$('#" . $id . "').datetimepicker({" : "$('#" . $id . "').datepicker({") . "
							duration: '',
							showTime: true,
							constrainInput: false,
							stepMinutes: 1,
							stepHours: 1,
							altTimeField: '',
							time24h: true,
							dateFormat: '" . $format . "'" . ($time ? ", timeFormat: 'HH:mm:00'" : "") . "
						});
					});
				");

				$done[] = $id;
			}

			return '<span class="input-datetime">' . self::text($name, $value, $options) . '</span>';
		}
		else
		{
			$value = (0 !== (int) $value ? with(new Date($value))->format('Y-m-d H:i:s') : '');

			return self::text($name . 'disabled', (0 !== (int) $value ? with(new Date($value))->format('Y-m-d H:i:s') : ''), $options) .
				   self::hidden($name, $value, $options);
		}
	}
1104287
public function display(string $fieldname, $value, string $model = null)
    {
        if (is_array($value)) {
            $return = '';
            foreach ($value as $v) {
                if ($return == '') {
                    $return .= $v;
                } else {
                    $return .= ', ' . $v;
                }
            }
            $value = $return;
        }

        return $value;
    }
837302
public function display(string $fieldname, $value, string $model = null)
    {
        if (!is_object($value)) {
            $value = new Time($value);
        }
        $value->setTimezone('Europe/Berlin');

        return $value->nice();
    }
1322755
public function display_data() {
        // Check if time was specified.
        if (!empty($this->field->param3)) {
            $format = get_string('strftimedaydatetime', 'langconfig');
        } else {
            $format = get_string('strftimedate', 'langconfig');
        }

        // Check if a date has been specified.
        if (empty($this->data)) {
            return get_string('notset', 'profilefield_datetime');
        } else {
            return userdate($this->data, $format);
        }
    }
320271
public function parseValue($value)
    {
        $date = \DateTime::createFromFormat(DATE_ATOM, $value);
        if (!$date) {
            throw new Error(sprintf("Cannot represent following value as date: %s", Utils::printSafeJson($value)));
        }

        return $date;
    }
102091
protected function timestamp_to_date_array($value) {
        $calendartype = \core_calendar\type_factory::get_calendar_instance();
        $currentdate = $calendartype->timestamp_to_date_array($value, $this->_options['timezone']);
        return array(
            'minute' => $currentdate['minutes'],
            'hour' => $currentdate['hours'],
            'day' => $currentdate['mday'],
            'month' => $currentdate['mon'],
            'year' => $currentdate['year']);
    }
989389
public function weekday($value = null)
    {
        $dayOfWeek = ($this->dayOfWeek + 7 - intval($this->getTranslationMessage('first_day_of_week') ?? 0)) % 7;

        return is_null($value) ? $dayOfWeek : $this->addDays($value - $dayOfWeek);
    }
212877
public function setValue($value) {

		// special behavior for DateTime
		if (is_a($value, 'DateTime') and is_a($this, 'Pair\FormControlInput')) {

			// if UTC date, set user timezone
			if (defined('UTC_DATE') and UTC_DATE) {
				$app = Application::getInstance();
				$value->setTimezone($app->currentUser->getDateTimeZone());
			}

			// can be datetime or just date
			$format = (isset($this->type) and 'date'==$this->type) ? $this->dateFormat : $this->datetimeFormat;
			$this->value = $value->format($format);

		} else {

			$this->value = $value;

		}

		return $this;

	}
799220
public function displayValue( $value )
    {
        return $this->view->numberFormat(
            (float) $value,
            NumberFormatter::DECIMAL,
            NumberFormatter::TYPE_DOUBLE
        );
    }
1198624
private static function _parseTwoDateTimeStrings($value)
    {
        $dateStrings = explode(',', $value);
        if (count($dateStrings) !== 2)
            return null;

        $timestamps = [];

        foreach ($dateStrings as $dateString) {
            $result = @preg_match('/^\d\d\d\d-\d?\d-\d?\d \d\d:\d\d:\d\d$/', $dateString);
            if ($result !== 1)
                return null;
            $timestamp = strtotime($dateString);
            if ($timestamp === false)
                return null;

            $timestamps[] = $timestamp;
        }
        return $timestamps;
    }
1202444
public function date($name, $value = null, $min = null, $max = null, $options = array())
    {
        if( !isset($min) && !isset($max) ) return 'The date field "'.$name.'" must have a min, max or both.';
        
        if( isset($min) ) $options['min'] = $min;
        if( isset($max) ) $options['max'] = $max;
        
		return $this->input('date', $name, $value, $options);
    }
565493
public function output($value = null)
    {
        return Cuztom::view('fields/'.$this->view, [
            'tabs'  => $this,
            'value' => $value,
            'type'  => $this->type,
        ]);
    }
194501
private function getLocalizedDate($value = null)
    {
        if ($value) {
            $value = $this->dateService
                ->toDateTime($value, 'app')
                ->format(Date::DB_FORMAT);
        }

        return $value;
    }