Change record status: 
Project: 
Introduced in branch: 
8.x
Introduced in version: 
8.x-dev
Description: 

There is a new theme function for the HTML5 <time> tag that has a 'datetime' attribute:

Added theme function

Added format_date() formats

  • 'html_datetime'
  • 'html_date'
  • 'html_time'
  • 'html_yearless_date'
  • 'html_week'
  • 'html_month'
  • 'html_year'

Usage example

from aggregator-feed-source.tpl.php:

<?php
if ($feed->checked) {
 
$variables['last_checked'] = theme('datetime', array(
   
'datetime' => $feed->checked,
   
'text' => t('@time ago', array('@time' => format_interval(REQUEST_TIME - $feed->checked)))
  ));
}
else {
 
$variables['last_checked'] = t('never');
}
?>
Impacts: 
Module developers
Themers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done

Comments

jessebeach’s picture

The aggregator source template is being updated to use datetime.

http://drupal.org/node/1189804

I'm in the process of updating other aggregator templates to use this function as well.