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

    Just typing datetime.datetime.now() in my Python 2.7 interactive console (IronPython hasn't updated yet) gives me the same behavior as the newer example using print() in the answer. I haven't successfully …

  2. 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 desired format …

  3. datetime - How to get UTC time in Python? - Stack Overflow

    Apr 11, 2013 · For Python 3, use datetime.now(timezone.utc) to get a timezone-aware datetime, and use .timestamp() to convert it to a timestamp.

  4. How can I get the current time (now) in UTC? - Stack Overflow

    78 I have a python datetime object (representing five minutes from now) which I would like to convert to UTC. I am planning to output it in RFC 2822 format to put in an HTTP header, but I am not sure if …

  5. How do I get a string format of the current date time, in python?

    You can use the datetime module for working with dates and times in Python. The strftime method allows you to produce string representation of dates and times with a format you specify.

  6. Python datetime module and getting current time

    Nov 15, 2020 · The datetime class is a little confusing to import because it's in a module that's also called datetime. When you do from datetime import datetime you're importing the class datetime into …

  7. What is the difference between python functions `datetime.now()` and ...

    Sep 11, 2015 · See the docs for datetime.today and datetime.now, specifically this part from the latter link: If optional argument tz is None or not specified, this is like today (), but, if possible, supplies …

  8. 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 datetime.datetime.now() or …

  9. What is the default `datetime.now()` timezone? - Stack Overflow

    May 18, 2024 · See this answer: Answer to How do I get a value of datetime.today () in Python that is "timezone aware"? > Mind that datetime.today () and datetime.now () return the local time, not the …

  10. python - Setting the time of datetime.now () - Stack Overflow

    Aug 20, 2017 · Setting the time of datetime.now () Asked 8 years, 5 months ago Modified 8 years, 5 months ago Viewed 203 times