Showing the current date and clock
Write a program that prints the current date and time in the output
Write a program that prints the current date and time in the output
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
from time import *
print(ctime(time()))
from datetime import datetime
# Getting the time and date of the present
now = datetime.now()
# Output format
formatted_time = now.strftime("%Y-%m-%d %H:%M:%S")
print("")
import datetime today=datetime.datetime.now() formatted_date=today.strftime('%Y-%m-%d %H:%M:%S') print(formatted_date)
import datetime x = datetime.datetime.now() print(x)
from datetime import datetime print(datetime.now())
from datetime import datetime data = datetime.today() print(data)
import time def Date(): print(time.ctime()) Date()
Submitting answers is currently unavailable.
You must be logged in to access this section.
Login/Sign up If you don’t understand the exercise or can’t solve it for any reason, that’s completely
normal—don’t worry 😊
Try checking out easier exercises and reviewing different answers
submitted by others. Gradually, you can move on to more challenging exercises. Also, your answer
might be correct even if it’s different from others.