parse function is powerful and convenient, and it is easy to handle time analysis in various string forms. However, when encountering an incomplete time format, such as '8-9 12:00', it can also be automatically parsed into 2017-8- 9 12:00, the default current year is used to complete the missing content.
The issue is
Is there a way to directly obtain the parsed string without automatically completing the missing parts?
Sorry, the question is not detailed enough, please add more.
For example "Juanary 1, 12:00"
Parse to get <datetime> 2017-1-1 12:00:00
All I need is <str> 1-1 12:00
In other words, I hope to block the automatic completion function and only need the parsed string of the actual content. Is there any good way to achieve this?
I checked the official documentation and found that there is no corresponding function. There is just a time template that is set to be replaced by default.
Can’t we use datetime’s strftime to format it?
It is indeed possible, but I have no way to determine whether the obtained data has been completed and which parts have been completed.
That’s the trouble.
Is there any way to deal with it?