How to convert the Drupal node “created” date to something readable
By David Pratt / Tags: date, drupal / 4 Comments / Published: 08-08-09
Should you want to display a user readable version of a Drupal 6 date field, the following code snippet might be of use to you:
<?php echo date("D, j M Y \a\\t G:i", $created_date) ?>For example, if created_date were to equal “1249641973″, it would get rendered as “Fri, 7 Aug 2009 at 11:46″. Nice.
Subscribe via RSS
Twitter
McSleazy February 11th, 2011 at 10:15 am
Thanks.
You could take a step further and put this in your template.php:
<?php function readabledate($enterdate) { $newdate = date("D, j M Y", $enterdate); return $newdate; } ?>Then, whenever you want a readable date, just use ‘readable date’ – such as:
But you probably already knew that. ;)