How to get current date and time in Python?
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
to get current date and time in Python:
from datetime import datetime now = datetime.now() dt_string = now.strftime("%d/%m/%Y %H:%M:%S") print("date and time =", dt_string) Output: date and time = 31/07/2021 06:50:31