# Expiration

Represents a date of expiration.

The amount can be specified either as a Date object, timestamp, Duration or string.

Obtainable from: Expiration.after, Expiration.atDate, Expiration.atTimestamp, Expiration.fromString

- Source: [`core/lib/expiration.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/core/lib/expiration.ts#L7)

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
const expiration = cdk.Expiration.after(cdk.Duration.minutes(30));
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk

expiration = cdk.Expiration.after(cdk.Duration.minutes(30))
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;

Expiration expiration = Expiration.after(Duration.minutes(30));
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;

var expiration = Expiration.After(Duration.Minutes(30));
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

expiration := cdk.Expiration_After(cdk.Duration_Minutes(jsii.Number(30)))
```

## Properties

- `date`: date — Expiration value as a Date object.

## Methods

- `after(t: Duration): Expiration // chainable` (static) — Expire once the specified duration has passed since deployment time.

  **Parameters**

  - `t` — the duration to wait before expiring.

- `atDate(d: date): Expiration // chainable` (static) — Expire at the specified date.

  **Parameters**

  - `d` — date to expire at.

- `atTimestamp(t: number): Expiration // chainable` (static) — Expire at the specified timestamp.

  **Parameters**

  - `t` — timestamp in unix milliseconds.

- `fromString(s: string): Expiration // chainable` (static) — Expire at specified date, represented as a string.

  **Parameters**

  - `s` — the string that represents date to expire at.

- `isAfter(t: Duration): boolean` — Check if Expiration expires after input.

  **Parameters**

  - `t` — the duration to check against.

- `isBefore(t: Duration): boolean` — Check if Expiration expires before input.

  **Parameters**

  - `t` — the duration to check against.

- `toEpoch(): number` — Expiration Value in a formatted Unix Epoch Time in seconds.
