---
title: "Session: How to Get Entity Last Modified"
url: "https://docs.ravendb.net/6.2/client-api/session/how-to/get-entity-last-modified"
version: "6.2"
language: "python"
---

# Session: How to Get Entity Last Modified

> Client language: Python. Also available for [C#](https://docs.ravendb.net/6.2/client-api/session/how-to/get-entity-last-modified.md), [Java](https://docs.ravendb.net/6.2/client-api/session/how-to/get-entity-last-modified.java.md), [PHP](https://docs.ravendb.net/6.2/client-api/session/how-to/get-entity-last-modified.php.md), [Node.js](https://docs.ravendb.net/6.2/client-api/session/how-to/get-entity-last-modified.nodejs.md).
>
> RavenDB publishes an official agent skill for coding assistants at https://docs.ravendb.net/skills/ravendb/SKILL.md (also installable with `npx skills add ravendb/skills`). The skill describes itself as: "Read this before writing any RavenDB query, client call or /databases/ request. Covers server setup, document modelling, the Node.js, .NET and Python clients, RQL, indexes, vector search and AI agents. Code written from recall tends to run and return the wrong rows, because RQL resembles SQL and the clients take field names as plain strings."

When a document is downloaded from the server it contains various metadata details,
including the last modified date of the document.

Last modified date is stored within the session metadata and is available for each
entity using the `get_last_modified_for` method from the `advanced` session operations.

## Syntax

```python
def get_last_modified_for(self, entity: object) -> datetime: ...
```

| Parameter | Type | Description |
| - | - | - |
| **entity** | `object` | Instance of an entity for which the last modified date will be returned. |

| Return Type | Description |
| - | - |
| `datetime` | Returns the last modified date for an entity. Throws an exception if the entity is not tracked by the session. |

## Example

```python
employee = session.load("employees/1-A")
last_modified = session.advanced.get_last_modified_for(employee)
```

## See also

- [What is a Session and How Does it Work](https://docs.ravendb.net/6.2/client-api/session/what-is-a-session-and-how-does-it-work.python.md)
- [How to Get and Modify Entity Metadata](https://docs.ravendb.net/6.2/client-api/session/how-to/get-and-modify-entity-metadata.md)
- [How to Get Entity Change-Vector](https://docs.ravendb.net/6.2/client-api/session/how-to/get-entity-change-vector.python.md)
