After hovering on the "submitted 2 months ago" I can get the created date of the post on reddit UI.
In my case, the post I'm looking at has this datetime: Fri Dec 18 02:06:06 2015 UTC
But when I call the reddit API using praw I'm getting this in the created_utc field: 1450404366.0
I'm not able to translate "Fri Dec 18 02:06:06 2015 UTC" to "1450404366.0"
Please help!
So what reddit is giving you is a UNIX TIMESTAMP
which is basically the seconds since Jan 01 1970. (UTC) that needs to be converted into a human-readable date time setup.
I would suggest using the datatime
module in python:
example usage:
import datetime
print(
datetime.datetime.fromtimestamp(
int("1284101485")
).strftime('%Y-%m-%d %H:%M:%S')
)
Hope this helps!