+++
# -----------------------------------------------------------------------
# Do not edit this file. It is automatically generated by API Documenter.
# -----------------------------------------------------------------------
title = "toDuration"
keywords = ["grafana","documentation","sdk","@grafana/data"]
type = "docs"
+++

## toDuration variable

### toDuration variable

<b>Signature</b>

```typescript
toDuration: (input?: string | number | DateTimeDuration | undefined, unit?: "year" | "years" | "y" | "month" | "months" | "M" | "week" | "weeks" | "w" | "day" | "days" | "d" | "hour" | "hours" | "h" | "minute" | "minutes" | "m" | "second" | "seconds" | "s" | "millisecond" | "milliseconds" | "ms" | "quarter" | "quarters" | "Q" | undefined) => DateTimeDuration
```
<b>Import</b>

```typescript
import { toDuration } from '@grafana/data';
```
