I have pulled date from excel to python , when I print the date in Python it shows like "2019-11-28 00:00:00" , which is not what I want . I want to again pass this date to python program in format 24-Nov-2019. How to do it ?
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.
from datetime import datetime
date_and_time = datetime.now()
print(date_and_time.strftime("%d-%b-%Y"))
Output:
24-Nov-2019