2021年1月1日星期五

How do I get the DateTime Python module to hold the day of the week without specifying the date?

Date = datetime.datetime.strptime(f"{AnimeListDates[show]['day_of_the_week']}-{AnimeListDates[show]['start_time']}", '%A-%H:%M')  

if I do Date.weekday() I will get 0(monday) no matter what I put in the day of the week field. After a little bit of testing I found out that the date when not specified defaults to 1970-01-01 which is a 0 (monday). Is there anyway I can make a datetime object hold the day of the week without a date? Working around this would be very tedious and require me to store a date for each day of the week and pass that in whenever it was detected or something along those lines.

Edit: An example of what could be in the f""(strptime) thursday-23:30

https://stackoverflow.com/questions/65536101/how-do-i-get-the-datetime-python-module-to-hold-the-day-of-the-week-without-spec January 02, 2021 at 12:52PM

没有评论:

发表评论