From 26314d0ef85d4a1e73ca6c9bd728a4cfb8d46d6b Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 12 Jun 2009 22:44:51 -0700 Subject: Create gallery::date_time(), gallery::date() and gallery::time() functions that format a unix timestamp into a date+time/date/time string. Partial fix for ticket #347. --- modules/gallery/helpers/gallery.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'modules/gallery/helpers/gallery.php') diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index 1686571c..e201fded 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -49,4 +49,31 @@ class gallery_Core { static function shutdown() { module::event("gallery_shutdown"); } + + /** + * Return a unix timestamp in a user specified format including date and time. + * @param $timestamp unix timestamp + * @return string + */ + static function date_time($timestamp) { + return date("Y-M-d H:i:s", $timestamp); + } + + /** + * Return a unix timestamp in a user specified format that's just the date. + * @param $timestamp unix timestamp + * @return string + */ + static function date($timestamp) { + return date("Y-M-d", $timestamp); + } + + /** + * Return a unix timestamp in a user specified format that's just the time. + * @param $timestamp unix timestamp + * @return string + */ + static function time($timestamp) { + return date("H:i:s", $timestamp); + } } \ No newline at end of file -- cgit v1.2.3