I have a function which returns a timestamp in unix time as int.
I need to convert this int to a string dd/mm/yy
in local time. The "local" part is causing me problems, if it weren't for that, I could have just made my own function to convert it.
I have searched around , and it seems the ctime
class from the standard library would be ideal for this, in a manner like this:
int unixtime;
std::cout << std::asctime(std::localtime(unixtime));
Sadly, only *time_t
is accepted. Is there any way I can convert int into this format, or any better way to get local time from unix time as int?