Python – How to create a datetime in Python from milliseconds

datetimepython

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

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)