How to calculate two time?
lookon
areyoulookon at gmail.com
Thu Oct 9 07:00:51 EDT 2008
Thank you for your help.It works.
However, I am using Google App Engine and cannot import dateutil and
epsilon.
Are there any other ways?
On Oct 8, 10:06 pm, s... at pobox.com wrote:
> lookon> I have two string like "2007-03-27T08:54:43+08:00 " how do I get
> lookon> the hours between these two time(string format)?
>
> Look in PyPI for dateutil, then:
>
> >>> import dateutil.parser
> >>> t1 = dateutil.parser.parse("2007-03-27T08:54:43+08:00")
> >>> t1
> datetime.datetime(2007, 3, 27, 8, 54, 43, tzinfo=tzoffset(None, 28800))
> >>> t2 = dateutil.parser.parse("2007-03-29T10:00:00+02:00") >>> t2
> datetime.datetime(2007, 3, 29, 10, 0, tzinfo=tzoffset(None, 7200))
> >>> t2 - t1
> datetime.timedelta(2, 25517)
>
> Skip
More information about the Python-list
mailing list