🌐
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.
🌐
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).
🌐
W3Schools
w3schools.com › python › gloss_python_date.asp
Python Date Time
import datetime x = datetime.datetime.now() print(x) Try it Yourself » · Python DateTime Tutorial Date Output Create a Date Object The strftime Method Date Format Codes ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com
🌐
w3resource
w3resource.com › python-exercises › python-basic-exercise-3.php
Python: Print current time and date - w3resource
Write a Python program to display the current date and time. ... The datetime module supplies classes for manipulating dates and times in both simple and complex ways. datetime.now(tz=None) returns the current local date and time.
🌐
W3Schools
w3schools.in › python › date-time
Python Date and Time - W3Schools
from datetime import datetime presentime = datetime.now() print(" NOW THE TIME IS:", presentime) print("Todays Date is:", presentime.strftime('%Y-%m-%d') ) print("Year is:", presentime.year) print("MOnth is:", presentime.month) print("Day is:", presentime.day) ... NOW THE TIME IS: 2016-06-14 18:01:25.831269 Todays Date is: 2016-06-14 Year is: 2016 MOnth is: 6 Day is: 14 · Python usually handles time's function as a tuple with nine numbers starting from zero (0) to eight (8).
🌐
W3Schools
w3schools.com › python › gloss_python_date_output.asp
Python Date Output
import datetime x = datetime.datetime.now() print(x.year) print(x.strftime("%A")) Try it Yourself » · Python DateTime Tutorial Datetime Module Create a Date Object The strftime Method Date Format Codes ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com
🌐
Codecademy
codecademy.com › docs › python › dates › datetime.now()
Python | Dates | datetime.now() | Codecademy
June 19, 2025 - The datetime.now() method is a class method from Python’s datetime module that returns a datetime object representing the current local date and time. This method captures the exact moment when it is called, including the year, month, day, ...
🌐
W3Schools
w3schools.com › python › trypython.asp
W3Schools online PYTHON editor
The W3Schools online code editor allows you to edit code and view the result in your browser
🌐
W3Schools
w3schools.am › python › python_datetime.html
Python Dates - W3Schools.am
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) Run example »
Find elsewhere
🌐
W3Schools
w3schoolsua.github.io › python › python_datetime_en.html
Python Datetime. Lessons for beginners. W3Schools in English
December 31, 2023 - 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 »
🌐
Programiz
programiz.com › python-programming › datetime › current-datetime
How to get current date and time in Python? (With Examples)
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)
🌐
Mimo
mimo.org › glossary › python › datetime
Python datetime Module: Working with Dates, Times, and Formatting
For example, you can add or subtract days, hours, minutes, and even seconds to a datetime object. Date arithmetic is particularly useful for calculating deadlines or future events. ... from datetime import datetime, timedelta now = datetime.now() tomorrow = now + timedelta(days=1) ...
🌐
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.
🌐
W3Schools
w3schools.com › python › ref_module_datetime.asp
Python datetime Module
Python Examples Python Compiler ... print(d.isoformat()) print(d.weekday()) Try it Yourself » · The datetime module supplies classes for manipulating dates and times....
🌐
Duke
fintechpython.pages.oit.duke.edu › jupyternotebooks › 1-Core Python › answers › rq-28-answers.html
Core Python / Dates and Times — Programming for Financial Technology
To create a datetime object representing the current date and time in Python, you can use the now() method of the datetime class from the datetime module.
🌐
Programiz
programiz.com › python-programming › datetime
Python datetime (With Examples)
To learn more about strptime() and format codes, visit: Python strptime(). Suppose, we are working on a project and need to display date and time based on their timezone. Rather than trying to handle the timezone yourself, we suggest using a third-party pytZ module. from datetime import datetime import pytz local = datetime.now() print("Local:", local.strftime("%m/%d/%Y, %H:%M:%S")) tz_NY = pytz.timezone('America/New_York') datetime_NY = datetime.now(tz_NY) print("NY:", datetime_NY.strftime("%m/%d/%Y, %H:%M:%S")) tz_London = pytz.timezone('Europe/London') datetime_London = datetime.now(tz_London) print("London:", datetime_London.strftime("%m/%d/%Y, %H:%M:%S"))
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-datetime-module
Python datetime module - GeeksforGeeks
July 26, 2025 - You can print current date and time using Datetime.now() function.
🌐
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.
🌐
Python Module of the Week
pymotw.com › 2 › datetime
datetime – Date/time value manipulation - Python Module of the Week
$ python datetime_comparing.py Times: t1: 12:55:00 t2: 13:05:00 t1 < t2: True Dates: d1: 2013-02-21 d2: 2013-02-22 d1 > d2: False · Use the datetime class to hold values consisting of both date and time components. As with date, there are several convenient class methods to make creating datetime ...