Commit 323c30e1 authored by Steven Wittens's avatar Steven Wittens

- Added "custom" date/time format... to allow user-timezone-adjusted custom...

- Added "custom" date/time format... to allow user-timezone-adjusted custom date formats. I didn't add special logic to translate parts of it, but it's not really needed, as this is only meant for internal usage (e.g. checking if timestamp A is on the same date as timestamp B).
  Some modules (such as diary) should be changed to take advantage of this function, as they are now still using GMT+0 dates in some cases (e.g. the recent diary entries box).
parent d6554be7
...@@ -65,7 +65,7 @@ function format_interval($timestamp) { ...@@ -65,7 +65,7 @@ function format_interval($timestamp) {
return ($output) ? $output : "0 sec"; return ($output) ? $output : "0 sec";
} }
function format_date($timestamp, $type = "medium") { function format_date($timestamp, $type = "medium", $format = "") {
global $user; global $user;
$timestamp += ($user->timezone) ? $user->timezone - date("Z") : 0; $timestamp += ($user->timezone) ? $user->timezone - date("Z") : 0;
...@@ -80,6 +80,9 @@ function format_date($timestamp, $type = "medium") { ...@@ -80,6 +80,9 @@ function format_date($timestamp, $type = "medium") {
case "large": case "large":
$date = t(date("l", $timestamp)) .", ". t(date("F", $timestamp)) ." ". date("d, Y - H:i", $timestamp); $date = t(date("l", $timestamp)) .", ". t(date("F", $timestamp)) ." ". date("d, Y - H:i", $timestamp);
break; break;
case "custom":
$date = date($format, $timestamp);
break;
default: default:
$date = t(date("l", $timestamp)) .", ". date("m/d/Y - H:i", $timestamp); $date = t(date("l", $timestamp)) .", ". date("m/d/Y - H:i", $timestamp);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment