Displaying Current Time and Date?

Is there anyway to display the current time(hr/min/sec) and the current date on to the simulator/app?? And does it update automatically? 

Is it possible to move the time and date around like “display.newText” where I can place where I want it to be?

I had heard about os.time and os.date but I suppose it is not able to display onto the simulator/app.

How should I go about it?

Thanks.

try reading this first

http://docs.coronalabs.com/api/library/os/date.html

see if that helps

There is also this blog post about time and dates: http://coronalabs.com/blog/2013/01/15/working-with-time-and-dates-in-corona/

Example of something updating every 1 second forever:

[lua]local currentTime = display.newText( “”, display.contentCenterX, 100, native.systemFont, 40)

local function updateTime()

currentTime.text = os.date()

end

timer.performWithDelay( 1000, updateTime, 0)[/lua]

Thanks for both of the replies!

I had gotten it. :slight_smile:

try reading this first

http://docs.coronalabs.com/api/library/os/date.html

see if that helps

There is also this blog post about time and dates: http://coronalabs.com/blog/2013/01/15/working-with-time-and-dates-in-corona/

Example of something updating every 1 second forever:

[lua]local currentTime = display.newText( “”, display.contentCenterX, 100, native.systemFont, 40)

local function updateTime()

currentTime.text = os.date()

end

timer.performWithDelay( 1000, updateTime, 0)[/lua]

Thanks for both of the replies!

I had gotten it. :slight_smile: