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

    Use the below sample script to get the current date and time in a Python script and print results on the screen. Create file getDateTime1.py with the below content.

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

    Try not to use python built in functions and variables as local variables (ex: today, year, day). Also, the request from the user is to get today's date in YYYY-MM-DD format.

  3. Date Time Formats in Python - Stack Overflow

    Jul 10, 2013 · What are these date-time formats? I need to convert them to the same format, to check if they are the same. These are just two coming from a separate data source, so I need …

  4. date - Subtracting datetime objects with Python - Stack Overflow

    The output timedelta (8747,23:48:42.94) or what ever will be days when u test the code indicates that the time delta encodes an offset of 8747 days and 23hour and 48 minute ...

  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. How to extract the year from a Python datetime object?

    I would like to extract the year from the current date using Python. In C#, this looks like: DateTime a = DateTime.Now() a.Year What is required in Python?

  7. python - What is the standard way to add N seconds to …

    Sep 19, 2008 · 739 You can use full datetime variables with timedelta, and by providing a dummy date then using time to just get the time value. For example: import datetime a = …

  8. python - How to print a date in a regular format? - Stack Overflow

    Oct 7, 2016 · In Python you can format a datetime using the strftime() method from the date, time and datetime classes in the datetime module. In your specific case, you are using the date …

  9. How to truncate the time on a datetime object? - Stack Overflow

    Mar 29, 2011 · What is a classy way to way truncate a python datetime object? In this particular case, to the day. So basically setting hour, minute, seconds, and microseconds to 0. I would …

  10. datetime - subtract two times in python - Stack Overflow

    You have two datetime.time objects so for that you just create two timedelta using datetime.timedetla and then substract as you do right now using "-" operand. Following is the …