Permalink
Browse files

Merge pull request #23 from michaelhelmick/datetime_to_timestamp

Datetime to timestamp
  • Loading branch information...
2 parents 2a73f90 + 0deeabb commit 4cead55ed92e212671b9561c668a1e8f938d4dbf @mikeyk mikeyk committed Mar 2, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 instagram/helper.py
View
@@ -1,4 +1,10 @@
+import calendar
from datetime import datetime
+
def timestamp_to_datetime(ts):
return datetime.utcfromtimestamp(float(ts))
+
+
+def datetime_to_timestamp(dt):
+ return calendar.timegm(dt.timetuple())

0 comments on commit 4cead55

Please sign in to comment.