Convert string to time?

I am trying to make a temp ban system and I need to convert “1d” into 1 day of seconds so I can use os.time, and other times like hours, etc. Any help would be appreciated

You can make like a table with the formats, like:

local Table = {
   ["m"] = 60,
   ["h"] = 3600,
   ["d"] = 86400,
   ["w"] = 604800,
   ["m"] = 2.628e+6
   
}

Table has everything in seconds.

And then split the number from the letter ‘2’ (1st) and ‘d’ (2nd), then multiply the Table[letter] by the number.

So, 2d would be: Table[Letter] * Number.Table["d"] * 2

2 Likes