Date.lua: Difference between revisions
Line 116: | Line 116: | ||
== num_dow_abr == | == num_dow_abr == | ||
'''INPUT:'''<BR> | |||
This library function required the following inputs/parameters. | |||
* Number of Day of Week | |||
**Starts with Sunday -Saturday | |||
'''OUTPUT:'''<BR> | |||
This library function deliverers the following output/parameters. | |||
* String of Full name of the month | |||
'''CODING EXAMPLE:''' | |||
-- Include/Call for this library | |||
require("date") | |||
print(date.num_dow_abr(6) | |||
--Fri | |||
==name_dow_num == | ==name_dow_num == | ||
== abr_dow_num == | == abr_dow_num == |
Revision as of 15:44, 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"
date_diff
INPUT:
This library function required the following inputs/parameters.
- Two dates as seconds to difference
- Example: (546775200, 976708800)
- Thu Apr 30 10:00:00 UTC 1987, Wed Dec 13 12:00:00 UTC 2000
- Example: (546775200, 976708800)
OUTPUT:
This library function deliverers the following output/parameters.
- A table
- temp = { min=0, day=17, month=8,sec=0,hour=2, year=13}
CODING EXAMPLE:
-- Include/Call for this library require("date") temp = date.date_diff(546775200, 976708800) --temp will be valued as above. This will not be completely accurate in relation to leap years...
num_month_name
INPUT:
This library function required the following inputs/parameters.
- Number of month to match
OUTPUT:
This library function deliverers the following output/parameters.
- String of Full name of the month
CODING EXAMPLE:
-- Include/Call for this library require("date") print(date.num_month_name(7) --July
num_month_name_abr
INPUT:
This library function required the following inputs/parameters.
- Number
OUTPUT:
This library function deliverers the following output/parameters.
- String of 3 letter abbreviation of
CODING EXAMPLE:
-- Include/Call for this library require("date") print(date.num_month_name_abr(7) --Jul
name_month_num
INPUT:
This library function required the following inputs/parameters.
- String - Full name of month to match
OUTPUT:
This library function deliverers the following output/parameters.
- Number of Month matched
CODING EXAMPLE:
-- Include/Call for this library require("date") print(date.name_month_num("July") --7
abr_month_num
INPUT:
This library function required the following inputs/parameters.
- String of Abbreviation of month name
OUTPUT:
This library function deliverers the following output/parameters.
- Number of Month
CODING EXAMPLE:
-- Include/Call for this library require("date") print(date.abr_month_num("Jul") --7
num_dow_name
INPUT:
This library function required the following inputs/parameters.
- Number of Day of Week
- Starts with Sunday -Saturday
OUTPUT:
This library function deliverers the following output/parameters.
- String of Full name of the month
CODING EXAMPLE:
-- Include/Call for this library require("date") print(date.num_dow_name(6) --Friday
num_dow_abr
INPUT:
This library function required the following inputs/parameters.
- Number of Day of Week
- Starts with Sunday -Saturday
OUTPUT:
This library function deliverers the following output/parameters.
- String of Full name of the month
CODING EXAMPLE:
-- Include/Call for this library require("date") print(date.num_dow_abr(6) --Fri