leisurehilt.blogg.se

Convert string to date python 24 hour time
Convert string to date python 24 hour time







convert string to date python 24 hour time convert string to date python 24 hour time

import reĭef date2timestamp_anyformat(format_date): pd.todatetime ('2018 - 07 - 07 04 - PM', format'Y - m - d I - p') Timestamp (' 16:00:00') This behaviour is documented in the docs: When used with the strptime () function, the p directive only.

convert string to date python 24 hour time

Using regex to cut string into then unpack it and fill into datetime class datetime.datetime(year, month, day, hour=0, minute=0, second=0, microsecond=0, tzinfo=None, *, fold=0), this is the fastest way I tested so far. Since you're parsing a 12-hour time format, you will need I instead of H, otherwise the p specifier has no effect.









Convert string to date python 24 hour time