summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorKjartan Mannes <kjartan@2.no-reply.drupal.org>2004-02-08 21:42:59 +0000
committerKjartan Mannes <kjartan@2.no-reply.drupal.org>2004-02-08 21:42:59 +0000
commit97c2aa2bda7c25e89770b25f5810cc544272c08c (patch)
treef0636119d58415da7194712ee42f022541d17685 /modules
parent325f9891b28ef3d1bb8f385057ad487ce9e9c79e (diff)
downloadbrdo-97c2aa2bda7c25e89770b25f5810cc544272c08c.tar.gz
brdo-97c2aa2bda7c25e89770b25f5810cc544272c08c.tar.bz2
- Modified format_date() to handle timezones properly.
Diffstat (limited to 'modules')
-rw-r--r--modules/node.module2
-rw-r--r--modules/node/node.module2
-rw-r--r--modules/system.module13
-rw-r--r--modules/system/system.module13
4 files changed, 24 insertions, 6 deletions
diff --git a/modules/node.module b/modules/node.module
index e5b9d29c5..5664702ab 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -1075,7 +1075,7 @@ function node_validate($node, &$error) {
}
if (!$node->date) {
- $node->date = date('M j, Y g:i a', $node->created);
+ $node->date = format_date($node->created, 'custom', 'Y-m-d H:i O');
}
if (!is_numeric($node->status)) {
diff --git a/modules/node/node.module b/modules/node/node.module
index e5b9d29c5..5664702ab 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -1075,7 +1075,7 @@ function node_validate($node, &$error) {
}
if (!$node->date) {
- $node->date = date('M j, Y g:i a', $node->created);
+ $node->date = format_date($node->created, 'custom', 'Y-m-d H:i O');
}
if (!is_numeric($node->status)) {
diff --git a/modules/system.module b/modules/system.module
index cf1d72d5c..b9a7918bb 100644
--- a/modules/system.module
+++ b/modules/system.module
@@ -86,10 +86,11 @@ function system_user($type, $edit, &$user) {
$data[t('Theme settings')] = form_item(t("Theme"), "<select name=\"edit[theme]\">$options</select>", t("Selecting a different theme will change the look and feel of the site."));
}
+ $timestamp = time();
$zonelist = array(-11, -10, -9.5, -9, -8, -7, -6, -5, -4, -3.5, -3, -2, -1, 0, 1, 2, 3, 3.5, 4, 5, 5.5, 5.75, 6, 6.5, 7, 8, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 14);
foreach ($zonelist as $offset) {
$zone = $offset * 3600;
- $zones["$zone"] = date(variable_get("date_format_long", "l, F dS, Y - g:ia"), time() - date("Z") + $zone) . sprintf(" (GMT %s%02d:%02d)\n", ($offset >= 0) ? "+" : "-", floor(abs($offset)), (abs($offset) * 60) % 60);
+ $zones[$zone] = format_date($timestamp, 'custom', variable_get('date_format_long', $datelong[0]) . ' O', $zone);
}
$data[t('Locale settings')] = form_select(t("Time zone"), "timezone", $edit["timezone"], $zones, t("Select what time you currently have and your time zone settings will be set appropriate."));
return $data;
@@ -141,6 +142,13 @@ function system_view_general() {
// date settings:
+ $timestamp = time();
+ $zonelist = array(-11, -10, -9.5, -9, -8, -7, -6, -5, -4, -3.5, -3, -2, -1, 0, 1, 2, 3, 3.5, 4, 5, 5.5, 5.75, 6, 6.5, 7, 8, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 14);
+ foreach ($zonelist as $offset) {
+ $zone = $offset * 3600;
+ $zones[$zone] = format_date($timestamp, 'custom', variable_get('date_format_long', $datelong[0]) . ' O', $zone);
+ }
+
// date settings: possible date formats
$dateshort = array("m/d/Y - H:i", "d/m/Y - H:i", "Y/m/d - H:i",
"m/d/Y - g:ia", "d/m/Y - g:ia", "Y/m/d - g:ia",
@@ -164,7 +172,8 @@ function system_view_general() {
$datelongchoices[$f] = format_date(time(), "custom", $f);
}
- $group = form_select(t("Date format (short)"), "date_format_short", variable_get("date_format_short", $dateshort[0]), $dateshortchoices, t("The short format of date display."));
+ $group = form_select(t("Time zone"), "date_default_timezone", variable_get('date_default_timezone', 0), $zones, t("Select the default site timezone."));
+ $group .= form_select(t("Date format (short)"), "date_format_short", variable_get("date_format_short", $dateshort[0]), $dateshortchoices, t("The short format of date display."));
$group .= form_select(t("Date format (medium)"), "date_format_medium", variable_get("date_format_medium", $datemedium[0]), $datemediumchoices, t("The medium sized date display."));
$group .= form_select(t("Date format (long)"), "date_format_long", variable_get("date_format_long", $datelong[0]), $datelongchoices, t("Longer date format used for detailed display."));
diff --git a/modules/system/system.module b/modules/system/system.module
index cf1d72d5c..b9a7918bb 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -86,10 +86,11 @@ function system_user($type, $edit, &$user) {
$data[t('Theme settings')] = form_item(t("Theme"), "<select name=\"edit[theme]\">$options</select>", t("Selecting a different theme will change the look and feel of the site."));
}
+ $timestamp = time();
$zonelist = array(-11, -10, -9.5, -9, -8, -7, -6, -5, -4, -3.5, -3, -2, -1, 0, 1, 2, 3, 3.5, 4, 5, 5.5, 5.75, 6, 6.5, 7, 8, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 14);
foreach ($zonelist as $offset) {
$zone = $offset * 3600;
- $zones["$zone"] = date(variable_get("date_format_long", "l, F dS, Y - g:ia"), time() - date("Z") + $zone) . sprintf(" (GMT %s%02d:%02d)\n", ($offset >= 0) ? "+" : "-", floor(abs($offset)), (abs($offset) * 60) % 60);
+ $zones[$zone] = format_date($timestamp, 'custom', variable_get('date_format_long', $datelong[0]) . ' O', $zone);
}
$data[t('Locale settings')] = form_select(t("Time zone"), "timezone", $edit["timezone"], $zones, t("Select what time you currently have and your time zone settings will be set appropriate."));
return $data;
@@ -141,6 +142,13 @@ function system_view_general() {
// date settings:
+ $timestamp = time();
+ $zonelist = array(-11, -10, -9.5, -9, -8, -7, -6, -5, -4, -3.5, -3, -2, -1, 0, 1, 2, 3, 3.5, 4, 5, 5.5, 5.75, 6, 6.5, 7, 8, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 14);
+ foreach ($zonelist as $offset) {
+ $zone = $offset * 3600;
+ $zones[$zone] = format_date($timestamp, 'custom', variable_get('date_format_long', $datelong[0]) . ' O', $zone);
+ }
+
// date settings: possible date formats
$dateshort = array("m/d/Y - H:i", "d/m/Y - H:i", "Y/m/d - H:i",
"m/d/Y - g:ia", "d/m/Y - g:ia", "Y/m/d - g:ia",
@@ -164,7 +172,8 @@ function system_view_general() {
$datelongchoices[$f] = format_date(time(), "custom", $f);
}
- $group = form_select(t("Date format (short)"), "date_format_short", variable_get("date_format_short", $dateshort[0]), $dateshortchoices, t("The short format of date display."));
+ $group = form_select(t("Time zone"), "date_default_timezone", variable_get('date_default_timezone', 0), $zones, t("Select the default site timezone."));
+ $group .= form_select(t("Date format (short)"), "date_format_short", variable_get("date_format_short", $dateshort[0]), $dateshortchoices, t("The short format of date display."));
$group .= form_select(t("Date format (medium)"), "date_format_medium", variable_get("date_format_medium", $datemedium[0]), $datemediumchoices, t("The medium sized date display."));
$group .= form_select(t("Date format (long)"), "date_format_long", variable_get("date_format_long", $datelong[0]), $datelongchoices, t("Longer date format used for detailed display."));