# EXPIRETIME

> Return the Unix time, in seconds, at which a key expires.

URL: https://docs.hotkv.com/commands/expiretime/

```
EXPIRETIME key
```

- Group: Keys
- Complexity: O(1)
- HotKV Cloud: all plans
- On-Premise: no license needed

`EXPIRETIME` returns the absolute Unix timestamp, in seconds and rounded to
the nearest second, at which `key` will expire. Reading it is not an access to
the key.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| The key has a time to live | Integer: Unix time in seconds | Integer |
| The key exists without a time to live | Integer `-1` | Integer `-1` |
| The key does not exist | Integer `-2` | Integer `-2` |

## Examples

```
127.0.0.1:6379> SET report "q3"
OK
127.0.0.1:6379> EXPIREAT report 1893456000
(integer) 1
127.0.0.1:6379> EXPIRETIME report
(integer) 1893456000
127.0.0.1:6379> EXPIRETIME missing
(integer) -2
```

## Compatibility

Same as Redis 7 and Valkey 8.

## See also

[PEXPIRETIME](https://docs.hotkv.com/commands/pexpiretime/index.md), [EXPIREAT](https://docs.hotkv.com/commands/expireat/index.md),
[TTL](https://docs.hotkv.com/commands/ttl/index.md)