datetime.datetime.now() takes tzinfo as keyword argument but datetime.today() does not take any keyword arguments.

By default, now() executes with datetime.datetime.now(tz=None)

As quoted in the docs: https://docs.python.org/3.6/library/datetime.html#datetime.datetime.now

datetime.now() return the current local date and time. If optional argument tz is None or not specified, this is like today(), but, if possible, supplies more precision than can be gotten from going through a time.time() timestamp (for example, this may be possible on platforms supplying the C gettimeofday() function).

Answer from Tevin Joseph K O on Stack Overflow
๐ŸŒ
Datadog
docs.datadoghq.com โ€บ security โ€บ code_security โ€บ static_analysis โ€บ static_analysis_rules โ€บ python-best-practices โ€บ no-datetime-today
do not use datetime.today()
Using today() makes you think it only returns the year/month/day but it returns a full timestamp. For this reason, prefer using now(). from datetime import datetime print("foo") bla = datetime.today() # use datetime.now() instead
Discussions

TIL that datetime.utcnow() is faster than datetime.now()
To anyone out there reading this: if datetime.now() is your performance bottleneck, you can probably stop optimizing. More on reddit.com
๐ŸŒ r/Python
78
709
October 23, 2023
Difference between datetime.now and datetime.now() in the code ?
Get access to thousands of hours ... today. Start your free trial ... Sorry for asking this so late, but why are we using datetime.now instead of datetime.now() in the Entry class. If only the name of the method(datetime.now) is used, instead of calling it (datetime.now()), How is this working?? ... In Python, functions ... More on teamtreehouse.com
๐ŸŒ teamtreehouse.com
2
December 16, 2015
Not understanding difference between system.date.now() and datetime.datetime.now()
I'm trying to modify an existing script that has the following date manipulations: now = system.date.now() end = system.date.midnight(system.date.addDays(now, -system.date.getDayOfMonth(now)+1)) # 1st of this month start = system.date.addMonths(end, -1) # 1 month prior to end And I need to ... More on forum.inductiveautomation.com
๐ŸŒ forum.inductiveautomation.com
1
0
February 21, 2023
What is the difference between datetime.now() and datetime.today() in Python - Stack Overflow
datetime.today gives you non timezone aware time. datetime.now acccepts timezone info as argument and can provide tz spcific time and date ... What platform are you talking about? The example code could be from at least a dozen languages. ... I was talking about Python. More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
Python documentation
docs.python.org โ€บ 3 โ€บ library โ€บ datetime.html
datetime โ€” Basic date and time types
As such, the recommended way to create an object representing the current time in UTC is by calling datetime.now(timezone.utc).
๐ŸŒ
Reddit
reddit.com โ€บ r/python โ€บ til that datetime.utcnow() is faster than datetime.now()
r/Python on Reddit: TIL that datetime.utcnow() is faster than datetime.now()
October 23, 2023 - Took me a few seconds to notice this was r/Python. The same is true in .NET, where DateTime.UtcNow is substantially faster than DateTime.Now.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ what-is-the-difference-between-python-functions-datetime-now-and-datetime-today
What is the difference between Python functions datetime.now() and datetime.today()?
June 13, 2020 - datetime.now() returns the current local date and time. If optional argument tz is None or not specified, this is like today(), but, if possible, supplies more precision than can be gotten from going through a time.time() timestamp (for example, this may be possible on platforms supplying the ...
๐ŸŒ
Python
bugs.python.org โ€บ issue41904
Issue 41904: datetime.datetime.today makes no sense and should be removed - Python tracker
October 1, 2020 - This issue tracker has been migrated to GitHub, and is currently read-only. For more information, see the GitHub FAQs in the Python's Developer Guide. Created on 2020-10-01 15:54 by yurzo, last changed 2022-04-11 14:59 by admin. This issue is now closed.
Find elsewhere
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 48680916 โ€บ what-is-the-difference-between-datetime-now-and-datetime-today-in-python
What is the difference between datetime.now() and datetime.today() in Python - Stack Overflow
datetime.today gives you non timezone aware time. datetime.now acccepts timezone info as argument and can provide tz spcific time and date ... What platform are you talking about?
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ datetime.date.today and timezones
r/learnpython on Reddit: datetime.date.today and timezones
October 19, 2021 -

I'm a student working on a Python project. In my code, I have a global variable:

today = date.today()

I am concerned with the date only, meaning I don't use time in my program. The only reason I would be concerned about time is for when it causes one today's date to switch to tomorrow's date.

Throughout my code, I reference this variable a bunch of times. For example:

  • today.day to get the current day of the month

  • today.strftime("%B") to get the current month name

  • today.year to get the current year, etc.

Recently, I have realized I need to deal with timezones. Upon looking up how to do this, I found some guides on how to use pytz. It seems fairly straightforward, however it all has to do with datetime.now() instead of date.today(), which I have been using throughout my code. I was hoping I could just swap in datetime.now(), but it messes things up because it has the date and the time, instead of just the date.

What is my best course of action? Is there a way for me to get date.today() to work with timezones/pytz, or do I need to re-work my code so that it can work with datetime.now()?

Hopefully this all makes sense. I just learned Python a few months ago. Thanks.

๐ŸŒ
Python
bugs.python.org โ€บ issue44307
Issue 44307: date.today() is half as fast as datetime.now().date() - Python tracker
This issue tracker has been migrated to GitHub, and is currently read-only. For more information, see the GitHub FAQs in the Python's Developer Guide ยท This issue has been migrated to GitHub: https://github.com/python/cpython/issues/88473
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_datetime.asp
Python Datetime
A date in Python is not a data type of its own, but we can import a module named datetime to work with dates as date objects. Import the datetime module and display the current date: import datetime x = datetime.datetime.now() print(x) Try it Yourself ยป ยท When we execute the code from the example above the result will be: The date contains year, month, day, hour, minute, second, and microsecond.
๐ŸŒ
Educative
educative.io โ€บ answers โ€บ what-is-the-datetime-datetoday-function-in-python
What is the datetime date.today() function in Python?
In Python, there are multiple ways to extract the current date. In this shot, we will use the today() method from the date class of the datetime module. The datetime.now() method can extract the current date and time.
๐ŸŒ
Built In
builtin.com โ€บ articles โ€บ date-python
Python Date vs. Datetime Objects Explained | Built In
In Python, a date object is used to present a calendar date, while a datetime object represents the date down to the microsecond. Hereโ€™s how to code date in Python: from datetime import datetime dt = datetime.now() # Gets the current date ...
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ python-datetime-now-how-to-get-todays-date-and-time
Python Datetime.now() โ€“ How to Get Today's Date and Time
September 20, 2022 - You can use the datetime module in Python to retrieve data about date and time. In this article, you'll learn how to use the datetime object from the datetime module to get the current date and time properties. You'll also learn how to get the date and time of different locations around the world using the datetime.now() function and the pytz module.
๐ŸŒ
Note.nkmk.me
note.nkmk.me โ€บ home โ€บ python
Get the Current Date and Time in Python: datetime.now, date.today | note.nkmk.me
April 22, 2025 - Convert between Unix time (Epoch time) and datetime in Python ยท Use datetime.now() from the datetime module to get a datetime object representing the current date and time.
๐ŸŒ
Programiz
programiz.com โ€บ python-programming โ€บ datetime โ€บ current-datetime
How to get current date and time in Python? (With Examples)
from datetime import date today = date.today() # dd/mm/YY d1 = today.strftime("%d/%m/%Y") print("d1 =", d1) # Textual month, day and year d2 = today.strftime("%B %d, %Y") print("d2 =", d2) # mm/dd/y d3 = today.strftime("%m/%d/%y") print("d3 =", d3) # Month abbreviation, day and year d4 = today.strftime("%b-%d-%Y") print("d4 =", d4) ... If we need to get the current date and time, you can use the datetime class of the datetime module. from datetime import datetime # datetime object containing current date and time now = datetime.now() print("now =", now) # dd/mm/YY H:M:S dt_string = now.strftime("%d/%m/%Y %H:%M:%S") print("date and time =", dt_string)
๐ŸŒ
Python
bugs.python.org โ€บ issue44831
Issue 44831: Inconsistency between datetime.now() and datetime.fromtimestamp(time.time(), None) - Python tracker
This issue tracker has been migrated to GitHub, and is currently read-only. For more information, see the GitHub FAQs in the Python's Developer Guide ยท This issue has been migrated to GitHub: https://github.com/python/cpython/issues/88994