About 349,000 results
Open links in new tab
  1. 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 …

  2. Datetime current year and month in Python - Stack Overflow

    There's also timedelta and tzinfo in there. One could just import datetime to get the whole package with all the submodules, but then method calls would look like …

  3. The correct way to import and use the datetime python library

    Mar 18, 2012 · That's because you are importing the datetime module (which contains classes for manipulating dates and times as stated in the documentation) not the datetime object. In such …

  4. Difference between Python datetime vs time modules

    Aug 15, 2017 · The time module is principally for working with Unix time stamps; expressed as a floating point number taken to be seconds since the Unix epoch. the datetime module can …

  5. python - AttributeError: module 'datetime' has no attribute 'now ...

    Jun 1, 2018 · Today I re-installed python, uninstalled anaconda, pycharm, and then download python 3.65-amd, also I can't run this code. print the type of datetime I got double print class …

  6. AttributeError: 'datetime' module has no attribute 'strptime'

    This will give you the error: 'module' object has no attribute 'strptime'. In this case, just flip the order of imports or just don't import everything (even if the documentation does that) :

  7. python - "import datetime" v.s. "from datetime import datetime"

    The difference between from datetime import datetime and normal import datetime is that , you are dealing with a module at one time and a class at other. The strptime function only exists in …

  8. python - AttributeError: module 'datetime' has no attribute 'today ...

    Sep 20, 2021 · You already imported datetime.timedelta as timedelta so you can use that. But you imported datetime.datetime as datetime so that is why it is saying 'datetime.datetime' has no …

  9. 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.

  10. Getting today's date in YYYY-MM-DD in Python? - Stack Overflow

    Since Python 3.9, you can use the built-in zoneinfo library to get timezones. Then once you get today's date as a datetime.datetime object, it's straightforward to convert to a string in the …