summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-06-13 13:44:51 +0800
committer <unostar@danalan.info>2009-06-13 20:10:24 +0800
commit3d89951c778265fb010d4bd20f93ced3ff7502d8 (patch)
treeafa69eb44960e21112d28c78c3777ace9f55487d /modules/gallery/helpers
parent96b533f1b2fe4e01d7dd7e98631833c2e3c13a71 (diff)
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. Signed-off-by: <unostar@danalan.info>
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r--modules/gallery/helpers/gallery.php27
1 files changed, 27 insertions, 0 deletions
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