Nov-24-2019, 12:26 PM
Is it a datetime object or is it a string?
If it is a string you will have to slice it and output it in the order you want.
If it is a datetime object you may want to format it using the strftime() method.
If it is a string you will have to slice it and output it in the order you want.
If it is a datetime object you may want to format it using the strftime() method.
from datetime import datetime date_and_time = datetime.now() print(date_and_time.strftime("%d-%b-%Y"))
Output:24-Nov-2019