0

For example I have the number(in milliseconds) 1439467747492 and I need to transform it in a data format.The number will return: Thu, 13 Aug 2015 12:09:07 GMT.

Is a function to do that or I need a specific code to do this?

Thank you!

  • Maybe you need [this](http://man7.org/linux/man-pages/man3/ctime.3.html). Answered [here](http://stackoverflow.com/questions/12286369/formatting-unix-timestamp-with-ctime-in-c) – Rolbrok Jan 17 '16 at 14:08
  • What is the reference point for these millisecond timestamps? Since epoch? – πάντα ῥεῖ Jan 17 '16 at 14:16

1 Answers1

2
#include <time.h>
#include <iostream>

int main() {
    time_t a = 1439467747492 / 1000; // or 1439467747
    std::cout << "The time is " << ctime(&a);
}
Rolbrok
  • 308
  • 1
  • 7