-1

Stuck at home and unable to have my mentor assist me as they are not allowed to visit. I've looked at documentation and after hours of trying I am turning to Stack Exchange for the first time. Apologies if this has been asked elsewhere.

I have an epoch time in a variable (int, right? or a float - not sure what is best), say, 1601863560000 - how do I convert that to my timezone and print out %h:%m:%s %d/%m/%y? I see people talking about installing pandas and tzlocal (whichever library is fine).

Thank you.

  • 1
    Welcome to Stack Overflow! Please visit the [help], take the [tour] to see what and [ask]. ***[Do some research](https://www.google.com/search?q=python+epoch+to+local+time+site:stackoverflow.com)***, search for related topics on SO; if you get stuck, post a [mcve] of your attempt, noting input and expected output using the `[<>]` snippet editor. – mplungjan Oct 05 '20 at 08:31

1 Answers1

0

If you have epoch in milliseconds then you should convert it to seconds

import time
time.ctime(epoch_time_in_milliseconds/1000)