# HEXPIRETIME

> Get the absolute expiry time of hash fields as a Unix time in seconds.

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

```
HEXPIRETIME key FIELDS numfields field [field ...]
```

- Group: Hash
- Complexity: O(N) where N is the number of fields given
- HotKV Cloud: all plans
- On-Premise: no license needed

`HEXPIRETIME` returns the moment each listed field of the hash at `key` will
expire, as a Unix timestamp in seconds (rounded up).

`FIELDS` must come right after the key, and `numfields` must equal the number
of field names that follow.

## Return value

An array with one integer per field, in the order given, under both RESP2 and
RESP3:

| Value | Meaning |
| --- | --- |
| `-2` | The field or the key does not exist. |
| `-1` | The field exists but has no expiry. |
| Positive integer | The expiry as a Unix time in seconds. |

The errors are the same as for [HTTL](https://docs.hotkv.com/commands/httl/index.md).

## Examples

```
127.0.0.1:6379> HSET promo:3 code "SPRING" banner "on"
(integer) 2
127.0.0.1:6379> HEXPIREAT promo:3 1924992000 FIELDS 1 code
1) (integer) 1
127.0.0.1:6379> HEXPIRETIME promo:3 FIELDS 3 code banner none
1) (integer) 1924992000
2) (integer) -1
3) (integer) -2
```

## Compatibility

Same as Redis 7.4. Valkey 8 does not have hash field expiration.

## See also

[HPEXPIRETIME](https://docs.hotkv.com/commands/hpexpiretime/index.md), [HEXPIREAT](https://docs.hotkv.com/commands/hexpireat/index.md), [HTTL](https://docs.hotkv.com/commands/httl/index.md),
[EXPIRETIME](https://docs.hotkv.com/commands/expiretime/index.md)