1
0

date.luadoc 1.0 KB

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