convert from 12 hrs to 24 python

Solutions on MaxInterview for convert from 12 hrs to 24 python by the best coders in the world

showing results for - "convert from 12 hrs to 24 python"
Yannick
23 Oct 2020
1    >>> from datetime import datetime
2    >>> m2 = '1:35 PM'
3    >>> in_time = datetime.strptime(m2, "%I:%M %p")
4    >>> out_time = datetime.strftime(in_time, "%H:%M")
5    >>> print(out_time)
6    13:35
7