Hello everyone,
I am using cck + date and my issue is that the values that I enter in my date field are shifted by 8 hours after I save them. My site's timzone is set to vancouver and user set timezones are restricted. Using devel I found that timezone_db is set to UTC which explains this 8 hour shift.
I am on a shared host and therefore do not have any access to changing the timezone of the database.
Does anyone know how I could fix this problem?
By browsing through the forums I found this potential fix but since I am very new to Drupal and web design in general I am not sure how I would implement this.
<?php
function format_date($timestamp, $type = 'medium', $format = '', $offset = NULL, $langcode = NULL, $timezone = NULL) {
switch ($type) {
case 'small':
$format = variable_get('date_format_short', 'm/d/Y - H:i');
break;
case 'large':
$format = variable_get('date_format_long', 'l, F j, Y - H:i');
break;
case 'custom':
// No change to format
break;
case 'medium':
default:
$format = variable_get('date_format_medium', 'D, m/d/Y - H:i');
}
$max = strlen($format);
if (USINGPHP4OFFSETS) {
if (!isset($offset)) {
global $user;
if (variable_get('configurable_timezones', 1) && $user->uid && strlen($user->offset)) {