Pacific-Design.com

    
Home Index

1. API

+ Bitly

+ Instagram

+ YouTube

API /

Facebook API

Facebook Marketing API

Video IDs

Unix Format for Facebook API Insights

#!/usr/bin/python
#-----------------------------------------------------------------------------------#
# Convert Date to Unix Format for Facebook API Insights
#-----------------------------------------------------------------------------------#
import time
import datetime

dt1 = time.mktime(datetime.datetime.strptime("2017-02-01", "%Y-%m-%d").timetuple())
dt2 = time.mktime(datetime.datetime.strptime("2017-02-02", "%Y-%m-%d").timetuple())

print 'since=' + str(int(dt1)) + '&until=' + str(int(dt2)

Output

since=1485936000&until=1486022400

Graph API Explorer
    v2.6/612330242258452/insights/?since=1485936000&until=1486022400

References