diff options
author | Matthew Wild <mwild1@gmail.com> | 2009-03-29 02:14:32 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2009-03-29 02:14:32 +0100 |
commit | 5ce49a3b6ca80f275df63bd4099e7f0efd9a2733 (patch) | |
tree | b9bf9d622f4bd7f8271ed7eda376ba9c0c72bd9c | |
parent | 3ab003a5146d2f501a1f9146d6e89403fea330fa (diff) | |
download | prosody-5ce49a3b6ca80f275df63bd4099e7f0efd9a2733.tar.gz prosody-5ce49a3b6ca80f275df63bd4099e7f0efd9a2733.zip |
util.datetime: Allow specifying a time to format
-rw-r--r-- | util/datetime.lua | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/util/datetime.lua b/util/datetime.lua index 97dcb8b4..8e77718d 100644 --- a/util/datetime.lua +++ b/util/datetime.lua @@ -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; |