---
title: "Get the date of the previous successful DAG run in Airflow."
description: "Get the start time or the execution date of the previous successful DAG run in Airflow"
author: "Bartosz Mikulski"
author_bio: "Principal AI Engineer & MLOps Architect. I bridge the gap between \"it works in a notebook\" and \"it works for 200 million users.\""
author_url: https://mikulskibartosz.name
author_linkedin: https://www.linkedin.com/in/mikulskibartosz/
author_github: https://github.com/mikulskibartosz
canonical_url: https://mikulskibartosz.name/time-of-previous-successful-dag-run-in-airflow
---

Airflow macros have three variables that we can access to get the dates related to the previous DAG runs.

First, we can access the previous execution date by using the {% raw %} `{{ prev_execution_date }}` {% endraw %} macro. In my opinion, it has limited usage because, in general, we know how often the DAG runs and what should be the previous execution date.

A way more useful variable is the {% raw %} `{{ prev_execution_date_success }}` {% endraw %}, which gives us the previous successful DAG run's execution date. We can use it to filter the data and retrieve only the values that were not available during the last successful run.

If we use the current date as a filter while retrieving the data, we may also need the {% raw %} `{{ prev_start_date_success }}` {% endraw %} variable, which returns the start time of the previous successful run.

