Skip to content

Instantly share code, notes, and snippets.

@jcisio
Created May 31, 2013 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcisio/5685082 to your computer and use it in GitHub Desktop.
Save jcisio/5685082 to your computer and use it in GitHub Desktop.
Drupal: Format Date field
$node = node_load(48617);
$item = $node->field_simplenews_date[LANGUAGE_NONE][0];
$date = new DateObject($item['value'], $item['timezone_db'], date_type_format($item['date_type']));
// $date->format is not localized
$timestamp = $date->format(U);
print format_date($timestamp, 'custom', 'd F Y');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment