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

    datetime.datetime(2015, 2, 18, 4, 55, 58, 753949, tzinfo=<UTC>) Equivalently, in Python 3 we have the timezone class with a utc timezone instance attached, which also makes the object …

  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. datetime - Python Timezone conversion - Stack Overflow

    Jun 12, 2012 · Time conversion To convert a time in one timezone to another timezone in Python, you could use datetime.astimezone (): so, below code is to convert the local time to other time …

  4. TypeError: 'module' object is not callable - using datetime

    nowTime = datetime.datetime.now() where the first datetime is the module, and the second one is the class in it - with the classmethod now() which creates an object with current local date and …

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

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

  8. 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) :

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

  10. python - type object 'datetime.datetime' has no attribute …

    Oct 16, 2012 · Datetime is a module that allows for handling of dates, times and datetimes (all of which are datatypes). This means that datetime is both a top-level module as well as being a …