Python Datetime – How to Create a Datetime in Python from Milliseconds?

datetimepython

How do I create a datetime in Python from milliseconds? I can create a similar Date object in Java by java.util.Date(milliseconds).

Allocates a Date object and initializes it to represent the specified number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT.

Best Answer

Just convert it to timestamp

datetime.datetime.fromtimestamp(ms/1000.0)
Related Question