---
title: tasks.lastSuccess() function
description: tasks.lastSuccess() returns the time of the last successful run of the InfluxDB task or the value of the orTime parameter if the task has never successfully run.
url: https://docs.influxdata.com/flux/v0/stdlib/influxdata/influxdb/tasks/lastsuccess/
estimated_tokens: 559
product: Flux
version: v0
---

# tasks.lastSuccess() function

-   Flux 0.84.0+
-   View InfluxDB support

`tasks.lastSuccess()` returns the time of the last successful run of the InfluxDB task or the value of the `orTime` parameter if the task has never successfully run.

##### Function type signature

```js
(orTime: A) => time where A: Timeable
```

For more information, see [Function type signatures](/flux/v0/function-type-signatures/).

## Parameters

### orTime

(Required) Default time value returned if the task has never successfully run.

## Examples

### Return the time an InfluxDB task last successfully ran

```js
import "influxdata/influxdb/tasks"

tasks.lastSuccess(orTime: 2020-01-01T00:00:00Z)
```
