This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

lua table range of dates
#1
How can i create a lua table of the last dates and days for the previous 14 day period, starting at today?  
I want to end up with {day 1 = {date = "8/19/2020", day = "wednesday"}, day_two = {date = "7/19/2020", day = "Tuesday"}....... }

i started with 
Code:
t = os.date("*t")
data ={}
today = os.date('%w') --%w weekday (3) [0-6 = Sunday-Saturday]
Index  = 1

for i = 1, 14 do

data[i] = today -Index
Index = Index+1

end
how can i filter out the -ve values and make it circular 0-6  to line up with the %w pattern
Reply


Messages In This Thread
lua table range of dates - by benanderson_475 - 20.08.2020, 05:17
RE: lua table range of dates - by admin - 20.08.2020, 06:46
RE: lua table range of dates - by Dré - 20.06.2021, 11:48
RE: lua table range of dates - by admin - 20.06.2021, 12:25

Forum Jump: