Date.lua: Difference between revisions
Line 18: | Line 18: | ||
==seconds_to_date == | ==seconds_to_date == | ||
'''INPUT:'''<BR> | |||
This library function required the following inputs/parameters. | |||
* Table of seconds since 1970 | |||
** Example: t = { 546775200, 976708800, 1578657600 } | |||
'''OUTPUT:'''<BR> | |||
This library function deliverers the following output/parameters. | |||
* Will give a table with a formated string | |||
** temp = { {Thu Apr 30 10:00:00 UTC 1987}, {Wed Dec 13 12:00:00 UTC 2000}, {Fri Jan 10 12:00:00 UTC 2020} } | |||
'''CODING EXAMPLE:''' | |||
-- Include/Call for this library | |||
require("date") | |||
temp = date.seconds_to_date(t) --see t above | |||
-- the formated string is found in the top of date.lua | |||
-- is format = "%a %b %d %X %Z %Y" | |||
==date_diff == | ==date_diff == | ||
Revision as of 14:55, 27 November 2007
date_to_seconds
INPUT:
This library function required the following inputs/parameters.
- Table of dates
- Example: t = { {year=2000,month=12,day=13}, {year=1987,month=4,day=30,hour=10}, {year=2020,month=1,day=10} }
OUTPUT:
This library function deliverers the following output/parameters.
- Sorted table of dates in seconds since 1970
- temp = { 546775200, 976708800, 1578657600 }
CODING EXAMPLE:
-- Include/Call for this library require("date") temp = date.date_to_seconds(t) --see table t above for a,b in ipairs(temp) do print(b) end --546775200 --976708800 --1578657600
seconds_to_date
INPUT:
This library function required the following inputs/parameters.
- Table of seconds since 1970
- Example: t = { 546775200, 976708800, 1578657600 }
OUTPUT:
This library function deliverers the following output/parameters.
- Will give a table with a formated string
- temp = { {Thu Apr 30 10:00:00 UTC 1987}, {Wed Dec 13 12:00:00 UTC 2000}, {Fri Jan 10 12:00:00 UTC 2020} }
CODING EXAMPLE:
-- Include/Call for this library require("date") temp = date.seconds_to_date(t) --see t above -- the formated string is found in the top of date.lua -- is format = "%a %b %d %X %Z %Y"