For real time:
function onUpdate(dt)
date = castle.getServerDate("*t", "player")
form = deck.variables.TimeForm
sec = date.sec
min = date.min
hour = date.hour
if form == 1 then
hour %= 12
end
my.variables.m = min
my.variables.h = hour
h_display = "$h"
m_display = "$m"
if hour < 10 then
h_display = "0$h"
else
h_display = "$h"
end
if min < 10 then
m_display = "0$m"
else
m_display = "$m"
end
if form == 0 then
content = h_display .. " : " .. m_display
elseif form == 1 then
if date.hour > 12 then
content = h_display .. " : " .. m_display .. " PM"
else
content = h_display .. " : " .. m_display .. " AM"
end
end
my.text.content = content
end