SQLTerminal.app
now available

XPath.app
now available
Want fresh tech tips in your inbox?

How to Create A Unix Timestamp or the Epoch in Python

       

It's a little convoluted. Seeing as it's a pretty common thing you use when programming computers one might think that there would be a quick and easy method for it. But from what I can tell there isn't. So here is a snippet that will give you a *nix Epoch UTC timestamp.

import datetime
import calendar

now = datetime.datetime.utcnow()
timestamp = calendar.timegm(now.utctimetuple())
print timestamp
Tagged w/ #python #utc #timestamps #unix #epoch

Apps I've Built

XPath Expression Editor
Practice and improve your XPath skills with XPath Editor
Click to buy on the App Store
Photo Location Changer
Easily change the location on your photos and videos
Click here for more info about the app
Photo Date Changer
Easily change the dates and times on your photos and videos
Click here for more info about the app
VocabReminder
English dictionary with notifications so you won't forget what you're studying!
Click here for more info about the app
VocabQuiz
The app that quizzes and scores you on your vocabulary!
Click here for more info about the app