Trying to get am/pm based on TimeOfDay

I do it like this:

local hour12 = (math.floor(Lighting.ClockTime)+11)%12+1
local minute = math.floor(60*(Lighting.ClockTime%1))
local suffix = (Lighting.ClockTime>=12) and "PM" or "AM"

For display in a standard clock string, it would be something like:

local timeStr = tostring(hour12)..":"..(minute<10 and "0" or "")..tostring(minute).." "..suffix
8 Likes