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

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

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

    While this works for datetime, it doesn't work for date, because datetime is a subclass of date. For example if you try to test isinstance(my_datetime, datetime.date) it will return true, which you …

  4. How can I specify date and time in Python? - Stack Overflow

    Apr 10, 2022 · What is the object used in Python to specify date (and time) in Python? For instance, to create an object that holds a given date and time, (let's say '05/10/09 18:00').

  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 - 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. Subtracting datetime objects with Python - Stack Overflow

    10 When substracting two datetime objects you will get a new datetime.timedelta object.

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

  9. How do I turn a python datetime into a string, with readable format ...

    The datetime class has a method strftime. The Python docs documents the different formats it accepts: strftime () and strptime () Behavior For this specific example, it would look something like:

  10. date - In Python, how do you convert seconds since epoch to a …

    In Python, how do you convert seconds since epoch to a `datetime` object? Asked 15 years, 3 months ago Modified 1 year, 5 months ago Viewed 472k times