variable_get('date_format_short', 'm/d/Y - H:i'), 'medium' => variable_get('date_format_medium', 'D, m/d/Y - H:i'), 'large' => variable_get('date_format_long', 'l, F j, Y - H:i'), 'configurable_timezones' => variable_get('configurable_timezones', 1), 'date_default_timezone' => variable_get('date_default_timezone', 'UTC') ); } if (!isset($timezone)) { global $user; if (variable_get('configurable_timezones', 1) && $user->uid && $user->timezone) { $timezone = $user->timezone; } else { $timezone = $cache['variables']['date_default_timezone']; } } // Store DateTimeZone objects in an array rather than repeatedly // contructing identical objects over the life of a request. if (!isset($cache['timezones'][$timezone])) { $cache['timezones'][$timezone] = timezone_open($timezone); } // Use the default langcode if none is set. if (empty($langcode)) { global $language; $langcode = isset($language->language) ? $language->language : 'en'; } switch ($type) { case 'small': $format = $cache['variables']['small']; break; case 'large': $format = $cache['variables']['large']; break; case 'custom': // No change to format. break; case 'medium': default: $format = $cache['variables']['medium']; break; } // Create a DateTime object from the timestamp. $date_time = date_create('@' . $timestamp); // Set the time zone for the DateTime object. date_timezone_set($date_time, $cache['timezones'][$timezone]); // Encode markers that should be translated. 'A' becomes '\xEF\AA\xFF'. // xEF and xFF are invalid UTF-8 sequences, and we assume they are not in the // input string. // Paired backslashes are isolated to prevent errors in read-ahead evaluation. // The read-ahead expression ensures that A matches, but not \A. $format = preg_replace(array('/\\\\\\\\/', '/(?