For many of us in the business analytics world, working with dates and times is bread and butter stuff. We can work all kinds of magic with Excel's "serial" datetimes and worksheet functions like DATEVALUE(), WEEKDAY(), MONTH(), DATE() and many more. We can wield VBA functions like DateDiff with the best of them. We all know that, according to MS, time started on 1/1/1900 (or 1904 if you're on a Mac) and we just live with the fact that we can't do reliable datetime work before those magic epochs. I even wrote and released a free and open source MS Access add-in called Hillmaker many years ago that did statistical analysis of time interval data by day of week and time of day. That tool still finds lots of use in the healthcare world for analyzing occupancy of things like nursing units, emergency departments, recovery room, and many other places with entry and exit timestamp data.

So, when I started working with R and Python, one of the first things I did was see how they handled dates and times. I learned about the *UTC epoch* and the POSIX time standard. In R, I quickly learned to love the lubridate package. And then I started to learn about dates and times in Python and started to know what programmers mean when they say "there be dragons in there". So, while I'm far from an expert, I did put together this little intro to Python dates and times aimed at business analtytics types who are new to Python. It is by no means comprehensive, but does cover the basics of the base Python datetime and timedelta classes along with Numpy datetime64 and timedelta64 classes. Oh yeah, it also covers the pandas Timestamp and timedelta classes (confused yet?). I also show one particular dragon that bit me - conversion between Numpy datetimes and Pandas datetimes - even though Pandas uses Numpy under the hood.

Anyhoo, here we go with an IPython notebook based tutorial on this stuff.