provide date/time parsing for Python 2.4

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@4144 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2011-01-15 13:34:23 +00:00
parent 04f49c2dee
commit 7e2150f81c

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2009 Helmut Merz helmutm@cy55.de
# Copyright (c) 2011 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -23,6 +23,7 @@ $Id$
"""
import time
from datetime import datetime
def getTimeStamp():
@ -51,3 +52,6 @@ def str2timeStamp(s):
t = time.strptime(s, '%Y-%m-%d')
return int(time.mktime(t))
def strptime(s, format='%Y-%m-%d %H:%M:%S'):
return datetime(*(time.strptime(s, format)[:6]))