I have a list of date with this format : "190802 (2 august2019)"
.
I would like to format it to "02-08-19"
using datetime. Is there a fucntion to do?
Thanks
I have a list of date with this format : "190802 (2 august2019)"
.
I would like to format it to "02-08-19"
using datetime. Is there a fucntion to do?
Thanks
If I understand your question, you have a list of string inputs and you want to format them.
from datetime import datetime
input_list = ["190802 (2 august2019)"]
for input in input_list:
date = datetime.strptime(input[:6], "%y%m%d")
formated_output = date.strftime("%d-%m-%y")
print(formated_output)
>>>'02-08-19'