/** * @param string $type * * @return string */ public function display($type = self::DISPLAY_SHORT) : string { return Calendar::formatDate($this, $type); }
/** * Localization * @param string $type Type of localization * @param \DateTime|int|string $data parameters for this localization * @param array $options * @return string|int|false * * Returns the localized data. * * Implemented types: * - date * - Creates a date * - params: timestamp (int/string) * - datetime * - Creates date and time * - params: timestamp (int/string) * - time * - Creates a time * - params: timestamp (int/string) * - firstday: Returns the first day of the week (0 sunday - 6 saturday) * - jsdate: Returns the short JS date format */ public function l($type, $data = null, $options = array()) { // Use the language of the instance $locale = $this->getLanguageCode(); if ($locale === 'sr@latin') { $locale = 'sr_latn'; } if ($type === 'firstday') { return (int) Calendar::getFirstWeekday($locale); } if ($type === 'jsdate') { return (string) Calendar::getDateFormat('short', $locale); } $value = new \DateTime(); if ($data instanceof \DateTime) { $value = $data; } else { if (is_string($data) && !is_numeric($data)) { $data = strtotime($data); $value->setTimestamp($data); } else { if ($data !== null) { $value->setTimestamp($data); } } } $options = array_merge(array('width' => 'long'), $options); $width = $options['width']; switch ($type) { case 'date': return (string) Calendar::formatDate($value, $width, $locale); case 'datetime': return (string) Calendar::formatDatetime($value, $width, $locale); case 'time': return (string) Calendar::formatTime($value, $width, $locale); default: return false; } }
/** * @param string $type * * @return string */ public function display($type = self::DISPLAY_SHORT) : string { if ($type == self::DISPLAY_DURATION) { $format = []; if ($this->hour) { $format[] = Unit::format($this->hour, 'duration/hour'); } if ($this->minute) { $format[] = Unit::format($this->minute, 'duration/minute'); } if ($this->second) { $format[] = Unit::format($this->second, 'duration/second'); } return Misc::joinUnits($format, 'narrow'); } return Calendar::formatTime($this, $type); }
</div> <div id="ccm-permissions-access-entity-dates-repeat-weekly" style="display: none"> <div id="ccm-permissions-access-entity-dates-repeat-weekly-dow" style="display: none"> <div class="form-group"> <label class="control-label"><?php echo tc('Date', 'On'); ?> </label> <div class=""> <?php foreach (\Punic\Calendar::getSortedWeekdays('wide') as $weekDay) { ?> <div class="checkbox"><label><input <?php if (in_array($weekDay['id'], $pdRepeatPeriodWeekDays)) { ?> checked="checked" <?php } ?> type="checkbox" name="pdRepeatPeriodWeeksDays[]" value="<?php echo $weekDay['id']; ?> "/> <?php echo h($weekDay['name']); ?>
/** * @param string|array $type * * @return string */ public function display($type = null) : string { if ($type == self::DISPLAY_DURATION) { return $this->diffForHumans(DateTime::now(), true); } if (is_null($type)) { $type = [self::DISPLAY_SHORT, self::DISPLAY_SHORT]; } elseif (!is_array($type)) { $type = [$type, $type]; } elseif (is_array($type)) { if (!isset($type[1])) { return Calendar::formatDate($this, $type[0]); } elseif (is_null($type[0])) { return Calendar::formatTime($this, $type[1]); } } return Calendar::formatDatetime($this, implode('|', $type)); }
/** * @deprecated */ public function dateTimeFormatLocal($datetime, $mask) { return Calendar::format($datetime, Calendar::convertPhpToIsoFormat($mask)); }
public function getDateLabel($dateArray) { return \Punic\Calendar::getMonthName($dateArray['month']) . ' ' . $dateArray['year']; }