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.

Subtract 30 minutes from time value - 2021-05-12T19:30:00
#2
Use this:
Code:
123456789101112131415
str = '2021-06-01T00:00:00' date = {} -- assign table keys for further conversion date.year, date.month, date.day, date.hour, date.min, date.sec =   str:match('(%d+)-(%d+)-(%d+)T(%d+):(%d+):(%d+)') -- convert to unix timestamp and subtract 30 minutes in seconds timestamp = os.time(date) - 30 * 60 -- convert timestamp to table date = os.date('*t', timestamp) log(date)
Reply


Messages In This Thread
RE: Subtract 30 minutes from time value - 2021-05-12T19:30:00 - by admin - 12.05.2021, 10:31

Forum Jump: