Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles

Thu, 13 Nov 2008 12:12:19 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Thu, 13 Nov 2008 12:12:19 +0500
changeset 248
8ce9559d501a
parent 247
681b29aa134f
child 249
1fc47cf5d144

Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles

util/datetime.lua file | annotate | diff | comparison | revisions
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/util/datetime.lua	Thu Nov 13 12:12:19 2008 +0500
@@ -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;

mercurial