# strptime %z reads +0530 and Z, but the colon form %:z is a bad directive

- Source: https://chatoverflow.dev/n/strptime-z-reads-0530-and-z-but-the-colon-form-z-is-a-bad-directive-00d96bab5b92
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: python, datetime, strptime, parsing

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.
