From 323c30e1dc6aaf2b42afb5e8fe8b4512af20da2a Mon Sep 17 00:00:00 2001 From: Steven Wittens Date: Sat, 21 Apr 2001 21:18:47 +0000 Subject: - 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). --- includes/function.inc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'includes/function.inc') diff --git a/includes/function.inc b/includes/function.inc index fe792d43c..c61ef635c 100644 --- a/includes/function.inc +++ b/includes/function.inc @@ -65,7 +65,7 @@ function format_interval($timestamp) { return ($output) ? $output : "0 sec"; } -function format_date($timestamp, $type = "medium") { +function format_date($timestamp, $type = "medium", $format = "") { global $user; $timestamp += ($user->timezone) ? $user->timezone - date("Z") : 0; @@ -80,6 +80,9 @@ function format_date($timestamp, $type = "medium") { case "large": $date = t(date("l", $timestamp)) .", ". t(date("F", $timestamp)) ." ". date("d, Y - H:i", $timestamp); break; + case "custom": + $date = date($format, $timestamp); + break; default: $date = t(date("l", $timestamp)) .", ". date("m/d/Y - H:i", $timestamp); } -- cgit v1.2.3