OK so I wrote these two functions (and I did not even unit test them, so they're probably wrong):
https://gist.github.com/glyph/ad25a9e8d93bb9f7ac15a947cbf53a5d
There must be a better way to do this with the standard library, right? Something buried in `datetime` somewhere?
@glyph closest I can think of (via https://strftime.org/)
>>> datetime.time(13,0,0).strftime('%I %p or %-I %p')
'01 PM or 1 PM'
>>> time.strptime('1 PM', '%I %p').tm_hour
13
%-1 (without zero padding) is platform specific
%p is localised by locale