# NEXPIREAT

> Make a key expire at a Unix time given in nanoseconds.

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

```
NEXPIREAT key unix-time-nanoseconds
```

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

`NEXPIREAT` sets the moment `key` expires as an absolute Unix timestamp in
nanoseconds. It always replaces the current time to live. A timestamp that is
already in the past makes the key expire at once.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| The time was set | Integer `1` | Integer `1` |
| The key does not exist | Integer `0` | Integer `0` |

`ERR value is not an integer or out of range` when the timestamp is not a
64-bit integer.

## Examples

```
127.0.0.1:6379> SET report "q3"
OK
127.0.0.1:6379> NEXPIREAT report 1893456000000000000
(integer) 1
127.0.0.1:6379> PEXPIRETIME report
(integer) 1893456000000
```

## Compatibility

HotKV-only command. Unlike [EXPIREAT](https://docs.hotkv.com/commands/expireat/index.md), it takes no
`NX`, `XX`, `GT` or `LT` options and does not publish an `expire` keyspace
event.

## See also

[NEXPIRE](https://docs.hotkv.com/commands/nexpire/index.md), [NTTL](https://docs.hotkv.com/commands/nttl/index.md),
[PEXPIREAT](https://docs.hotkv.com/commands/pexpireat/index.md), [EXPIREAT](https://docs.hotkv.com/commands/expireat/index.md)