how can I convert 24 hour format to 12 hour format while using now() function.
from datetime import *
current_time = datetime.now()
print(current_time)
Any other ways to do this than strftime().
how can I convert 24 hour format to 12 hour format while using now() function.
from datetime import *
current_time = datetime.now()
print(current_time)
Any other ways to do this than strftime().
you can use strftime function
from datetime import *
current_time = datetime.now().strftime("%I:%M %p")
print(current_time)