About 50 results
Open links in new tab
  1. datetime - How do I get the current time in Python? - Stack Overflow

    Which version of Python was the original answer given in? Just typing datetime.datetime.now() in my Python 2.7 interactive console (IronPython hasn't updated yet) gives me the same behavior as the …

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

    datetime.seconds and datetime.microseconds are capped to [0,86400) and [0,10^6) respectively. They should be used carefully if timedelta is bigger than the max returned value.

  3. python - How to determine if a variable is a datetime object? - Stack ...

    I have a variable and I need to know if it is a datetime object. So far I have been using the following hack in the function to detect datetime object: if 'datetime.datetime' in str (type (variable...

  4. Convert date to datetime in Python - Stack Overflow

    Dec 21, 2009 · Is there a built-in method for converting a date to a datetime in Python, for example getting the datetime for the midnight of the given date? The opposite conversion is easy: datetime …

  5. python - How to convert integer timestamp into a datetime - Stack …

    I've tried Python's standard datetime.fromordinal() and datetime.fromtimestamp() and a few others, but nothing matches. I'm pretty sure that particular number corresponds to the current date (e.g. 2012-3 …

  6. python - How do I convert a datetime to date? - Stack Overflow

    Sep 18, 2010 · How do I convert a datetime.datetime object (e.g., the return value of datetime.datetime.now()) to a datetime.date object in Python?

  7. python - Convert Pandas Column to DateTime - Stack Overflow

    50 Use the pandas to_datetime function to parse the column as DateTime. Also, by using infer_datetime_format=True, it will automatically detect the format and convert the mentioned column …

  8. Convert DataFrame column type from string to datetime

    Jun 16, 2013 · How can I convert a DataFrame column of strings (in dd/mm/yyyy format) to datetime dtype?

  9. datetime - How do I get the current time in milliseconds in Python ...

    Jun 17, 2019 · 201 For Python 3.7+, time.time_ns() gives the time passed in nanoseconds since the epoch. This gives time in milliseconds as an integer:

  10. python - How to subtract a day from a date? - Stack Overflow

    Jan 13, 2009 · I have a Python datetime.datetime object. What is the best way to subtract one day?