Merge pull request #302 from chris5560/master
[project/luci.git] / modules / luci-base / luasrc / http / protocol / date.luadoc
1 ---[[
2 LuCI http protocol implementation - date helper class.
3
4 This class contains functions to parse, compare and format http dates.
5 ]]
6 module "luci.http.protocol.date"
7
8 ---[[
9 Return the time offset in seconds between the UTC and given time zone.
10
11 @class function
12 @name tz_offset
13 @param tz       Symbolic or numeric timezone specifier
14 @return         Time offset to UTC in seconds
15 ]]
16
17 ---[[
18 Parse given HTTP date string and convert it to unix epoch time.
19
20 @class function
21 @name to_unix
22 @param data     String containing the date
23 @return         Unix epoch time
24 ]]
25
26 ---[[
27 Convert the given unix epoch time to valid HTTP date string.
28
29 @class function
30 @name to_http
31 @param time     Unix epoch time
32 @return         String containing the formatted date
33 ]]
34
35 ---[[
36 Compare two dates which can either be unix epoch times or HTTP date strings.
37
38 @class function
39 @name compare
40 @param d1       The first date or epoch time to compare
41 @param d2       The first date or epoch time to compare
42 @return         -1  -  if d1 is lower then d2
43 @return         0   -  if both dates are equal
44 @return         1   -  if d1 is higher then d2
45 ]]
46