Drupal – Custom Date Snippets

I always hated how drupal group the post author and the date together in one little print function. So after finding out that I could use get_defined_vars() to find all the variables that are available for me to use to further customize the theme I’m working on.

Anyhow, here are the snippets for custom date.

Custom Date For Node

print format_date($node->created, 'custom', 'M d, Y');

Custom Date For Comment

print format_date($comment->timestamp, 'custom', 'M d, Y');

ps – wrap these around the php openning and closing.

This entry was posted in Drupal. Bookmark the permalink.

One Response to Drupal – Custom Date Snippets

  1. Adam Hegi says:

    Thanks for posting this. You helped me figure out how to write a custom date for Drupal’s Scheduler module. I blogged about it here: http://www.primalmedia.com/blog/how-print-custom-dates-using-contemplate-scheduler, and mentioned your post!

    Adam Hegi

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s