Game Development Community

Getting Date and Time from the Iphone/touch

by Jason Darby · in iTorque 2D · 08/03/2009 (11:57 am) · 2 replies

Is it possible to get the current date and time from the iphone into my game?

About the author

Computer games book author, have written 6 game creation books, published by Cengage Course Technology. Owner of Arcade website www.madword.com and Castle software.


#1
08/03/2009 (12:47 pm)
Here is a little code snippet:

Platform::LocalTime lt;
Platform::getLocalTime(lt);

char temp[128];
dSprintf(temp,128," %d/%d/%d ",lt.month+1,lt.monthday,lt.year+1900);

It'll put the date in the form of "8/02/2009" in the temp buffer. Modify to get what you need.
#2
08/03/2009 (12:51 pm)
Excellent, Thanks Kevin, much appreciated :)

Hopefully I will get iTGB in the next 3 or 4 weeks, so it is good to know that it can do what I need it to.