About 2,790,000 results
Open links in new tab
  1. datetime - subtract two times in python - Stack Overflow

    You have two datetime.time objects so for that you just create two timedelta using datetime.timedetla and then substract as you do right now using "-" operand. Following is the example way to …

  2. Subtract Two DateTime objects - Python - Stack Overflow

    Aug 26, 2015 · When you subtract two datetime objects in python, you get a datetime.timedelta object. You can then get the total_seconds() for that timedelta object and check if that is greater …

  3. How do I sort a list of datetime or date objects? - Stack Overflow

    Jan 23, 2013 · If your list is a mixture of date and datetimes, you can normalize them all into datetime objects, ...

  4. How do I find the time difference between two datetime objects in ...

    Aug 28, 2009 · If a, b are naive datetime objects such as returned by datetime.now() then the result may be wrong if the objects represent local time with different UTC offsets e.g., around DST …

  5. Find oldest/youngest datetime object in a list - Stack Overflow

    Oct 13, 2010 · I've got a list of datetime objects, and I want to find the oldest or youngest one. Some of these dates might be in the future. from datetime import datetime datetime_list = [ …

  6. How do I get the time difference between two DateTime objects …

    May 12, 2010 · DateTime a = new DateTime(2010, 05, 12, 13, 15, 00); DateTime b = new DateTime(2010, 05, 12, 13, 45, 00); Console.WriteLine(b.Subtract(a).TotalMinutes); When …

  7. How can i define a datetime object in Python? - Stack Overflow

    Jun 9, 2013 · datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]]) And the datetime.MINYEAR is 1, which means the minimum year value is 1. So you can not define a …

  8. TypeError: descriptor 'date' for 'datetime.datetime' objects doesn't ...

    Mar 2, 2021 · import datetime my_date = datetime.date(2021, 3, 2) or. from datetime import date my_date = date(2021, 3, 2) Why? The issue is that datetime.datetime.date() is a method on a …

  9. Pythonic way to combine datetime.date and datetime.time objects

    I have two objects that represent the same event instance --- one holds the date, the other the time of this event, and I want to create a datetime object. Since one can't simply add date and time …

  10. .net - How to compare DateTime in C#? - Stack Overflow

    Explanation from MSDN about DateTime.Compare (This is also relevant for operators like >, <, == and etc.): To determine the relationship of t1 to t2, the Compare method compares the Ticks …

Refresh