X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=util%2Fdatetime.lua;h=c582a424f8bfafec6e05e6b9b5452034f2d71720;hb=d62e87560c3d31b20bd786513d210c9d15e293e2;hp=04c5ec6a7e96574f832fa2787355ee5eef2c5dd9;hpb=a4d1701bd5e08cce7b221200394776a3171ddcac;p=prosody.git diff --git a/util/datetime.lua b/util/datetime.lua index 04c5ec6a..c582a424 100644 --- a/util/datetime.lua +++ b/util/datetime.lua @@ -1,4 +1,4 @@ --- Prosody IM v0.3 +-- Prosody IM -- Copyright (C) 2008-2009 Matthew Wild -- Copyright (C) 2008-2009 Waqas Hussain -- @@ -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;