Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local utc = 2
- local one_day = 86400 -- 60*60*24
- local function set_hours(tbl_date, h, m, s)
- tbl_date.hour = h
- tbl_date.min = m
- tbl_date.sec = s
- return os.time(tbl_date)
- end
- local current_time = os.time() + (utc*60*60) -- Time with UTC
- local current_day = os.date('*t', current_time)
- local clear_date = set_hours(current_day, 0, 0, 0)
- local next_day_date = clear_date + one_day
- local sec_to_next_day = next_day_date - current_time
- -- Test
- print('UTC', utc)
- print('Sec to next day', sec_to_next_day)
- print('Today', os.date('%c', os.time(current_day)))
- print('Next', os.date('%c', current_time + sec_to_next_day))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement