diff options
-rw-r--r-- | examples/trip-query.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/examples/trip-query.py b/examples/trip-query.py index 1c814d5..10c9648 100644 --- a/examples/trip-query.py +++ b/examples/trip-query.py @@ -19,6 +19,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +import datetime import sys import optparse @@ -130,7 +131,12 @@ def parse_datetime(when): if not when: return None - date, time = when.split('T') + try: + date, time = when.split('T') + except ValueError: + time = when + date = str(datetime.date.today()) + y, m, d = date.split('-') H, M = time.split(':') return tuple(map(int, [y, m, d, H, M, '00'])) |