# Working with Datetime Objects and Timezones in Python

> Sharing how to change timezones in Python

\ <br>

### Converting ISO 8601 Format to datetime (KST)

<br>

#### Example Explanation

```python
non_kst_date = '2020-10-23T10:36:05+03:00'
```

* This is a string in **ISO 8601 Format** with UTC +03:00

<br>

```python
seoul_timezone = pytz.timezone('Asia/Seoul')
```

* You can set the timezone using the **pytz** library

<br>

```python
parsed_date = datetime.strptime(non_kst_date, '%Y-%m-%dT%H:%M:%S%z')
```

* Converts the string format to a **datetime object**

<br>

```python
kst_date = parsed_date.astimezone(seoul_timezone)
```

* Converts the datetime object to the **Asia/Seoul timezone**

Done!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://chloe-codes1.gitbook.io/til/python/python-101/working_with_datetime_objects_and_timezones_in_python.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
