What is the proper Drupal way to deal with timestamp fields?

I wanted to create two timestamp fields in a MySQL table, but ran into some problems that I can't solve (see this question). So now I want to try it with the INT fields and Unix timestamps that Drupal uses.

The two columns in question are for "created" and "updated" purposes. What is the Drupal way to store a record with the current (UTC) time and how can I retrieve those timestamps in the user's own timezone? My server is on UTC time and I'm using Drupal 7.

  • A Unix timestamp is always UTC, no matter what timezone the server is in. – Citricguy Sep 26 '12 at 9:25
  • Doh! You are absolutely right. – Whiskey Sep 26 '12 at 10:17


I think that as long as you use Drupal to display/calculate the time, you shouldn't be worrying about time differences between the users or the site.

  • That works, for those who found this question, you can covert the timestamp back to a readable format with date_format. – Whiskey Sep 26 '12 at 10:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.