Changeset

921:f97d37a7d8a6

util.datetime: Allow specifying a time to format
author Matthew Wild <mwild1@gmail.com>
date Sun, 29 Mar 2009 02:14:32 +0100
parents 920:e302cbc9d036
children 922:0e45234360cd
files util/datetime.lua
diffstat 1 files changed, 28 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/util/datetime.lua	Thu Mar 26 03:55:45 2009 +0000
+++ b/util/datetime.lua	Sun Mar 29 02:14:32 2009 +0100
@@ -7,31 +7,31 @@
 --
 
 
--- XEP-0082: XMPP Date and Time Profiles
-
-local os_date = os.date;
-local error = error;
-
-module "datetime"
-
-function date()
-	return os_date("!%Y-%m-%d");
-end
-
-function datetime()
-	return os_date("!%Y-%m-%dT%H:%M:%SZ");
-end
-
-function time()
-	return os_date("!%H:%M:%S");
-end
-
-function legacy()
-	return os_date("!%Y%m%dT%H:%M:%S");
-end
-
-function parse(s)
-	error("datetime.parse: Not implemented"); -- TODO
-end
-
-return _M;
+-- XEP-0082: XMPP Date and Time Profiles
+
+local os_date = os.date;
+local error = error;
+
+module "datetime"
+
+function date(t)
+	return os_date("!%Y-%m-%d", t);
+end
+
+function datetime(t)
+	return os_date("!%Y-%m-%dT%H:%M:%SZ", t);
+end
+
+function time(t)
+	return os_date("!%H:%M:%S", t);
+end
+
+function legacy(t)
+	return os_date("!%Y%m%dT%H:%M:%S", t);
+end
+
+function parse(s)
+	error("datetime.parse: Not implemented"); -- TODO
+end
+
+return _M;