parse date

Hi I’d like to parse a date with corona, however I’m not sure how to do this with the os.date function. I can parse the current date, but how can I use a future date with this function?

Thanks in advance! [import]uid: 43961 topic_id: 8811 reply_id: 308811[/import]

Ok I’ve worked this out now:

local mytime= os.time{year=2011, month=05, day=13, hour=14, min=8, sec=0 }

local futureTime = os.date( ‘*t’, mytime )

local difference=os.difftime( mytime, os.time())

This now returns the difference in seconds.

Is there a simple way to convert this into days, hours, minutes, seconds?

Cheers [import]uid: 43961 topic_id: 8811 reply_id: 32115[/import]

Did you ever find an answer to this? [import]uid: 61102 topic_id: 8811 reply_id: 61018[/import]

function seconds2dhms(secs)  
 local left=secs  
 local days=math.floor(left/86400)   
 left=left%86400  
 local hours=math.floor(left/3600)   
 left=left%3600  
 local minutes=math.floor(left/60)   
 local seconds=left%60  
 return {days,hours,minutes,seconds}  
end  

[import]uid: 6459 topic_id: 8811 reply_id: 61479[/import]