Get the current date and time on the android.

When developing for iPhone, you could use the NSDate class to get the date and time. I don’t see any cocos2dx library function that allows you to do this. Will I have to delve in to the Android functions themselves? That would be disappointing because I can’t even seem to get the Android fully working.

could CCTime::gettimeofdayCocos2d meet your demand?

Interesting, I didn’t see that in the documentation. I will check on that once I get home, and if it works you’ve saved me hours of searching, Thanks!

Hmm, that seems like an extension, and I would also need to know the date itself, not just rather than just the time of day. It seemed like that’s the only function that class had.

Hi,

localtime() is your friend! :slight_smile:

http://www.cplusplus.com/reference/clibrary/ctime/localtime/