0
votes

I'm just wondering what could be the reason for this line to return a formatted string

    print(os.time{year=2018, month=11, day=11, hour=11})

returns 2018-11-11 11:00:00

where if I go to lua demo it returns date in numbers

is that a reason because of system difference? What can I do to get these numbers? My main goal is to add certain of days to the date. In following format :

oldDate + (60*60*24*daysToAdd)
1
Where did you get your Lua interpreter from? Are you sure you haven't redefined os.time? - lhf
@lhf I didn't think about it actually. We use in-build lua interpreter that goes with the engine so it must be them that redefined some functions. What a pity. Thank you. - thedumbone

1 Answers

1
votes

Probably you still can add days despite of non-standard os.time.
Try

local dt = os.date("*t") -- today 
print(dt.day, dt.month)  -- 28 nov
dt.day = dt.day + 111    -- add 111 days
dt = os.date("*t", os.time(dt))
print(dt.day, dt.month)  -- 19 mar

Does it print March 19 ?