timespanCheck if timestamp falls within specific boundaries | |
Download |
timespan Ranking & Summary
Advertisement
- License:
- MIT/X Consortium Lic...
- Price:
- FREE
- Publisher Name:
- Justine Tunney
- Publisher web site:
- https://github.com/jart/
timespan Tags
timespan Description
Timespans allow you to check if a timestamp falls within a specified list of boundaries. For example, you might want to program your phone system to only accept calls Mon-Fri from 9 a.m. to 5 p.m. except on holidays like Christmas.Timespans are specified in the form of times|daysofweek|days|months. If your timespan starts with !, it'll only match if the timestamps falls outside the given range.timespan is a Python module that provides the ability to check if timestamp falls within specific boundaries.Basic example:import timespanfrom datetime import datetimebusiness_hours = if timespan.match(business_hours, datetime.now()): print "we're open for business!"else: print "sorry, we're closed :("For more examples, see the documentation or source code.InstallationFrom folder:sudo python setup.py installFrom cheeseshop:sudo pip install timespanFrom git:sudo pip install git+git://github.com/jart/timespan.gitProduct's homepage
timespan Related Software