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 whether you accept or reject these cookies being set.

Separate and sort string
I have a string in ISO 8601 format: 2021-06-23T20: 16: 16.000 + 02: 00
But I want it in the format: 06-23-2021, 20:16:16.
How could I do it?

Use this:
date = '2021-06-23T20:12:16'
year, month, day, hour, min, sec = date:match('(%d+)-(%d+)-(%d+)T(%d+):(%d+):(%d+)')
res = string.format('%s-%s-%s, %s:%s:%s.', day, month, year, hour, min, sec)
thanks for the answer it works perfectly.

Forum Jump: