Home / Server

server.parseTime()

server.parseTime(text)

Parses a Faraway duration string and returns its length in seconds.

Parameters

NameTypeDescription
textstringDuration text accepted by the server's duration parser.

Returns

A number of seconds, or nil if the text is not a valid duration.

Example

local seconds = server.parseTime("1h30m")
if seconds then
  server.tempban("Alex", seconds, "Temporary ban", "Example")
end

Notes

The parser supports Faraway duration formats such as 30s, 10m, 2h, 3d, and 1w.