[Django]-How do I compare DateTime objects to UNIX timestamps when filtering results in django?

6👍

Try making a datetime object from a timestamp by using the datetime.datetime.fromtimestamp function. Here’s a quick demonstration:

In [7]: import datetime

In [8]: datetime.datetime.fromtimestamp(2344353453)
Out[8]: datetime.datetime(2044, 4, 15, 19, 17, 33)

Leave a comment