Epoch Time convertion

30 views
Skip to first unread message

Shijin Bose

unread,
Apr 6, 2017, 3:31:08 AM4/6/17
to cctz
Hi,
     I have a time in epoch format (UTC) i want to convert that to local time zone (like "America/Los_Angeles"). is it possible to directly convert this using "cctz::convert()" ?
    How can i achieve this?
   Thanks & Regards,
   Shijin Bose 

Bradley White

unread,
Apr 6, 2017, 12:05:25 PM4/6/17
to cctz
Hi  Shijin,


On Thursday, April 6, 2017 at 3:31:08 AM UTC-4, Shijin Bose wrote:
I have a time in epoch format (UTC) i want to convert that to local time zone (like "America/Los_Angeles"). is it possible to directly convert this using "cctz::convert()" ?
How can i achieve this?

Can you be more explicit as to the types/formats of your input and output.  That is, what do you mean by "a time in epoch format (UTC)"?

Thanks.

Shijin Bose

unread,
Apr 12, 2017, 6:47:01 AM4/12/17
to cctz
Hi Bradly,
     Epoch time means the UTC time is converted to seconds (like epoch = 1491993773 (long int) corresponding GMT time = 2017:04:12 10:42:53). so i want to convert this seconds time to human readable time. ( I mean  input given as seconds and output as normal human readable time)

Thanks & Regards,
Shijin Bose

Bradley White

unread,
Apr 12, 2017, 2:13:05 PM4/12/17
to cctz
OK.  Then consider something like ...

  cctz::format("%Y-%m-%d %H:%M:%S %Ez",
               std::chrono::system_clock::from_time_t(1491993773),
               cctz::local_time_zone());

which produces "2017-04-12 06:42:53 -04:00" for me.

Shijin Bose

unread,
Apr 18, 2017, 6:02:41 AM4/18/17
to cctz
Hi Bradley,
    Thanks a lot for this solution. :)
Reply all
Reply to author
Forward
0 new messages