About 62 results
Open links in new tab
  1. how to calculate timedelta python - Stack Overflow

    Aug 4, 2010 · timedelta() generates an object representing an amount of time—the Greek letter delta is used in math to represent "difference". So to compute an addition or a subtraction of an amount of time, you take the starting time and add the change, or delta, that you want. The specific call you've quoted is for generating the timedelta for 2.5 hours.

  2. python - Formatting timedelta objects - Stack Overflow

    As per documentation, timedelta objects are normalized, and a negative timedelta is represented by a negative day instance attribute. From the documentation: Note that normalization of negative values may be surprising at first. and that. String representations of timedelta objects are normalized similarly to their internal representation.

  3. How to add delta to python datetime.time? - Stack Overflow

    Sep 16, 2012 · It's easiest to just use datetime instead of time when doing addition. I've had use cases where I just made a dummy datetime.datetime(1, 1, 1, hour, minute) do the timedelta addition and then convert to time. –

  4. Python - Date & Time Comparison using timestamps, timedelta

    Aug 26, 2012 · You should be able to use. tdelta.total_seconds() to get the value you are looking for. This is because tdelta is a timedelta object, as is any difference between datetime objects. A couple of notes: Using strftime followed by strptime is superfluous. You should be able to get the current datetime with datetime.now.

  5. python - Using datetime.timedelta to add years - Stack Overflow

    Jan 28, 2019 · input args: input_time (datetime.date), interval (datetime.timedelta) return: datetime.date; I looked at the datetime and datetime.timedelta docs. class datetime.timedelta(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0)¶. These seem to work well if I want to add a certain number of hours or weeks. However, Problem:

  6. python - How to construct a timedelta object from a simple string ...

    Jan 7, 2011 · After this you can use your timedelta object as normally, convert it to seconds to make sure we did the ...

  7. python - Format timedelta to string - Stack Overflow

    Jun 30, 2013 · for python 2.7 and greater use .total_seconds() method ... """timedelta to string, use for measure running ...

  8. python time + timedelta equivalent - Stack Overflow

    How to use python timedelta function. 0. Using the datetime timedelta function. 1. Python timedelta with ...

  9. python - How to convert a timedelta object into a datetime object ...

    Oct 25, 2018 · It doesn't make sense to convert a timedelta into a datetime, but it does make sense to pick an initial or starting datetime and add or subtract a timedelta from that. >>> import datetime >>> today = datetime.datetime.today() >>> today datetime.datetime(2010, 3, 9, 18, 25, 19, 474362) >>> today + datetime.timedelta(days=1) datetime.datetime ...

  10. How do I convert datetime.timedelta to minutes, hours in Python?

    Jan 7, 2013 · A datetime.timedelta corresponds to the difference between two dates, not a date itself. It's only expressed in terms of days, seconds, and microseconds, since larger time units like months and years don't decompose cleanly (is 30 days 1 month or 0.9677 months?).

Refresh