Created
November 15, 2013 17:04
-
-
Save Quilted/7487840 to your computer and use it in GitHub Desktop.
Drupal 7 dates with proper timezone handling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Assumes date field is $variables['field_event_date'] | |
$dateObj = new DateObject($variables['field_event_date'][0]['value'], new DateTimeZone($variables['field_event_date'][0]['timezone_db'])); | |
$dateObj->setTimezone(new DateTimeZone($variables['field_event_date'][0]['timezone'])); | |
$date = $dateObj->getTimestamp(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From https://drupal.org/comment/5792522#comment-5792522