A Python program to display the current date and time | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

A Python program to display the current date and time

s=input (" today is: ") print(s) y=input("time is: ") print(y) Did someone have a better way to write it ?

22nd Nov 2016, 1:45 AM
TROISIEME
TROISIEME - avatar
5 Answers
0
import time # 24 hour format y = time.strftime("%H:%M:%S") # 12 hour format y = time.strftime("%I:%M:%S") # dd/mm/yyyy format x = time.strftime("%d/%m/%Y")
22nd Nov 2016, 1:46 AM
Samuel Neo
Samuel Neo - avatar
0
Thank you. there is any way you can explain the program to me? when I click on run it doesn't work
22nd Nov 2016, 2:06 AM
TROISIEME
TROISIEME - avatar
0
thanks you again I figure it out
22nd Nov 2016, 2:09 AM
TROISIEME
TROISIEME - avatar
0
1) What is the difference between the capital and the lower case letter when is comes to time? I have been playing with both and I gate difference answers but I can find a good explanation on the internet. 2) what is the code for the local time in python. a link with time code will be helpful to
26th Nov 2016, 5:48 PM
TROISIEME
TROISIEME - avatar
0
https://docs.python.org/3/genindex-all.html
27th Nov 2016, 4:32 PM
TROISIEME
TROISIEME - avatar