Mercurial > prosody-hg
comparison util/datetime.lua @ 248:8ce9559d501a
Added util.datetime: Utility methods to support XEP-0082: XMPP Date and Time Profiles
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Thu, 13 Nov 2008 12:12:19 +0500 |
| parents | |
| children | cccd610a0ef9 |
comparison
equal
deleted
inserted
replaced
| 247:681b29aa134f | 248:8ce9559d501a |
|---|---|
| 1 -- XEP-0082: XMPP Date and Time Profiles | |
| 2 | |
| 3 local os_date = os.date; | |
| 4 local error = error; | |
| 5 | |
| 6 module "datetime" | |
| 7 | |
| 8 function date() | |
| 9 return os_date("!%Y-%m-%d"); | |
| 10 end | |
| 11 | |
| 12 function datetime() | |
| 13 return os_date("!%Y-%m-%dT%H:%M:%SZ"); | |
| 14 end | |
| 15 | |
| 16 function time() | |
| 17 return os_date("!%H:%M:%S"); | |
| 18 end | |
| 19 | |
| 20 function legacy() | |
| 21 return os_date("!%Y%m%dT%H:%M:%S"); | |
| 22 end | |
| 23 | |
| 24 function parse(s) | |
| 25 error("datetime.parse: Not implemented"); -- TODO | |
| 26 end | |
| 27 | |
| 28 return _M; |
