util.datetime API

Provides utility functions for retrieving the current or specified time in the formats specified by XEP-0082.

Using

   local datetime = require "util.datetime";

Reference

In all cases, t is a Lua time value, as returned by os.time(). On most systems this is stored as the number of seconds since midnight 1970-01-01.

When t is not specified, the current time is used.

datetime.date(t)

Returns the time t (or the current time if t is nil or not given) in the format given by the 'Date' profile of XEP-0082.

An example return value is:

2009-03-29

datetime.datetime(t)

Returns the time t (or the current time if t is nil or not given) in the format given by the 'DateTime' profile of XEP-0082.

An example return value is:

2009-03-29T00:33:50Z

datetime.time(t)

Returns the time t (or the current time if t is nil or not given) in the format given by the 'Time' profile of XEP-0082.

An example return value is:

14:34:47
 
doc/developers/util/datetime.txt · Last modified: 2009/12/20 17:43 (external edit)