Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I remove specific elements from a TimeStamp?

For example, I have this date right here. (2009-02-24T15:37:37.58Z) and I want to remove specific elements to just display the year, month and day. So it would look like this. (2009-02-24)

How can I archieve something like this using Lua?

1 answer

✓ Accepted answer

Generally, you can use gsub which can replace a pattern in the string with a desired character(s), which we can use empty strings for to remove specific elements. In this case, we can just search for a substring matching a "T" and everything else that follows it and replace it with an empty string. In layman's terms, it will remove the character "T" and everything else that follows it so you're just left with the date.

timestamp = timestamp:gsub("T.*", "")

This discussion is preserved as it was. New answers, comments, and votes are closed.