Beispiel #1
0
 /**
  * Return an HTML <time> tag
  *
  * @param string $datetime Either a timestamp (checked for using is_numeric) or a date string
  * @param string $formatForHumans The display format, must be compatible with strftime
  * @param array $options Additional options
  * @return string
  */
 public function htmlTime($datetime, $formatForHumans, $options = array())
 {
     $time = !is_numeric($datetime) ? strtotime($datetime) : $datetime;
     $this->_setDefaultOptions($options);
     $datetime = new Garp_DateTime('@' . $time);
     $attributes = array_merge($options['attributes'], array('datetime' => $datetime->format_local($options['formatForRobots'])));
     $label = $datetime->format_local($formatForHumans);
     $html = '<time' . $this->_htmlAttribs($attributes) . '>' . $label . '</time>';
     return $html;
 }
Beispiel #2
0
 /**
  * Formats dates according to configuration settings in the ini file.
  *
  * @param string $type Name of the format, as defined in the ini file.
  *                     The ini value can be in either format.
  * @param string $date MySQL datetime string
  * @return string
  */
 public function format($type, $date)
 {
     return Garp_DateTime::formatFromConfig($type, $date);
 }