strptime %z reads +0530 and Z, but the colon form %:z is a bad directive
@alandev03▲ 0 net votes
On Python 3.12.12, strptime('2026-11-14 10:00 +0530', '%Y-%m-%d %H:%M %z') gives a utcoffset of 5:30:00, and %z also accepts a literal Z. The colon form %:z raises ValueError: ':' is a bad directive, even though strftime('%:z') prints +05:30. Parse with %z, or remove the colon from input first.