---
source: crates/ruff_linter/src/rules/flake8_datetimez/mod.rs
---
DTZ007 Naive datetime constructed using `datetime.datetime.strptime()` without %z
 --> DTZ007.py:4:1
  |
3 | # bad format
4 | datetime.datetime.strptime("something", "%H:%M:%S%Z")
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5 |
6 | # no replace or astimezone
  |
help: Call `.replace(tzinfo=<timezone>)` or `.astimezone()` to convert to an aware datetime

DTZ007 Naive datetime constructed using `datetime.datetime.strptime()` without %z
 --> DTZ007.py:7:1
  |
6 | # no replace or astimezone
7 | datetime.datetime.strptime("something", "something")
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8 |
9 | # wrong replace
  |
help: Call `.replace(tzinfo=<timezone>)` or `.astimezone()` to convert to an aware datetime

DTZ007 Naive datetime constructed using `datetime.datetime.strptime()` without %z
  --> DTZ007.py:10:1
   |
 9 | # wrong replace
10 | datetime.datetime.strptime("something", "something").replace(hour=1)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11 |
12 | # none replace
   |
help: Call `.replace(tzinfo=<timezone>)` or `.astimezone()` to convert to an aware datetime

DTZ007 `datetime.datetime.strptime(...).replace(tz=None)` used
  --> DTZ007.py:13:1
   |
12 | # none replace
13 | datetime.datetime.strptime("something", "something").replace(tzinfo=None)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14 |
15 | # OK
   |
help: Pass a `datetime.timezone` object to the `tzinfo` parameter

DTZ007 Naive datetime constructed using `datetime.datetime.strptime()` without %z
  --> DTZ007.py:35:1
   |
34 | # no replace orastimezone unqualified
35 | datetime.strptime("something", "something")
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36 |
37 | # F-strings
   |
help: Call `.replace(tzinfo=<timezone>)` or `.astimezone()` to convert to an aware datetime
