12.05.2021, 12:37
Code:
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 string
result = os.date('%Y-%m-%dT%H:%M:%S', timestamp)
log(result)