From d9a45fe0e133695c0052893fab9aab0cdfa56aea Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 10 Jul 2005 19:21:18 +0000 Subject: [PATCH] Added date formatting framework. --- date.php | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 date.php diff --git a/date.php b/date.php new file mode 100644 index 0000000..1add242 --- /dev/null +++ b/date.php @@ -0,0 +1,115 @@ +servertz = date('Z', TIMENOW) / 3600; + } + + /** + * Computes the total offset, taking into account all + * the various options + */ + function fetch_offset() + { + $this->offsettz = $this->servertz - $this->usertz; + $this->offset = $this->offsettz * 3600; + } + + /** + * Formats a UNIX timestamp to a certain date format in the proper time zone + * + * @param string Format of the date (same as PHP's date() function) + * @param int UNIX timestamp to format + * @param bool Adjust the date to the user's language? + * + * @return string Formatted date + */ + function format($format, $timestamp = TIMENOW, $adjust = true) + { + $timestamp -= $this->offset; + return date($format, $timestamp); + } +} + +/*=====================================================================*\ +|| ################################################################### +|| # $HeadURL$ +|| # $Id$ +|| ################################################################### +\*=====================================================================*/ +?> \ No newline at end of file -- 2.43.5