On 7/4/2012 5:29 PM, Vlastimil Brom wrote:
Hi all,
I'd like to ask about the possibilities to do some basic manipulation
on timestamps - such as incrementing a given time (hour.minute -
string) by some minutes.
Very basic notion of "time" is assumed, i.e. dateless,
timezone-unaware, DST-less etc.
I first thought, it would be possible to just add a timedelta to a
time object, but, it doesn't seem to be the case.

   That's correct.  A datetime.time object is a time within a day.
A datetime.date object is a date without a time.  A datetime.datetime
object contains both.

  You can add a datetime.timedelta object to a datetime.datetime
object, which will yield a datetime.datetime object.

  You can also call time.time(), and get the number of seconds
since the epoch (usually 1970-01-01 00:00:00 UTC). That's just
a number, and you can do arithmetic on that.

  Adding a datetime.time to a datetime.timedelta isn't that
useful.  It would have to return a value error if the result
crossed a day boundary.

                                John Nagle


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to