From 5358129300fc848b130811999adb945773f171fb Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Thu, 13 Nov 2008 12:12:19 +0500 Subject: Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles --- util/datetime.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 util/datetime.lua diff --git a/util/datetime.lua b/util/datetime.lua new file mode 100644 index 00000000..077cbb67 --- /dev/null +++ b/util/datetime.lua @@ -0,0 +1,28 @@ +-- 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; -- cgit v1.2.3