I am given a list of time in military hours and minutes as a string. Naturally, I need to convert each string into a datetime object using the strptime class with the %H for military or 24-hour clock and %M for minutes. However, anytime I try to parse it I am getting an output for year,month,day hour.minute.seconds for no reason
ie.
from datetime import datetime
string_time = '18:00'
formatted_time = datetime.strptime(string_time, '%H:%M')
print(formatted_time)
output:
1900-01-01 18:00:00
Just this morning when I was working on the assignment it printed perfectly fine but out of nowhere I started getting this weird output. Nowhere in my directory or current file did I ever try to format a year-month-day time. I did however try to create an empty datetime object but scrapped it after figuring out you can't have an empty datetime object.