A basic Clock/Calendar

I am trying to create a basic clock/calendar. (I know how to do it in action script, but not in Lua.)
I will have artwork in the background and show the current time and date over it:
Example:

8: 52
Sunday,
November 22, 2009

What is the best way to do it in Corona?
What fonts are supported?
Thanks [import]uid: 2862 topic_id: 261 reply_id: 300261[/import]

How bout something like this to get you started

[code]
local holdClock = os.time();

[code]
local time = display.newText(“12:12:12:am”,35,180,nil,40);
time:setTextColor(0,255,0,255);

[code]
local function timer ( event )

[code]
local myTime = os.time()
if ( holdTime ~= myTime ) then

[code]
holdTime = myTime;

[code]
local t = os.date("*t");

[code]
local ampm = “am”;
if ( t.hour > 12 ) then
t.hour = t.hour - 12;
ampm = “pm”
end

[code]
local s = string.format("%2d:%2d:%2d%s",t.hour,t.min,t.sec,ampm);
print(s);
time.text = s;

[code]
end

[code]
end

[code]
local function main ()

[code]
Runtime:addEventListener(“enterFrame”,timer);

[code]
end

[code]
main(); [import]uid: 24 topic_id: 261 reply_id: 326[/import]

wow - that was fast! I already have it working - Thanks!
How about the date?
Any Font choices?
Thanks again! [import]uid: 2862 topic_id: 261 reply_id: 327[/import]

I have it working, but there is one bug: after midnight, “0” shows instead of “12” … so instead of 12.15, it shows 0:15 … 12 afternoon works fine … how can I fix that?

[import]uid: 2862 topic_id: 261 reply_id: 345[/import]

I figured it out:

[code]
local function timer ( event )
local myTime = os.time()
if ( holdTime ~= myTime ) then
holdTime = myTime;
local t = os.date("*t");

[code]
local ampm = “am”;

[code]
if (t.hour == 12) then
ampm = “pm”;
end
if (t.hour < 12) then
ampm = “am”;
end
if (t.hour > 12) then
t.hour = t.hour - 12;
ampm = “pm”;
end
if (t.hour == 0) then
t.hour = 12;
ampm = “am”
end
[import]uid: 2862 topic_id: 261 reply_id: 387[/import]