# SEXPIRETIME

```json metadata
{
  "schema_version": 2,
  "title": "SEXPIRETIME",
  "description": "Returns the expiration time of a set member as a Unix timestamp, in seconds.",
  "categories": ["docs","develop","stack","oss","rs","rc","oss","kubernetes","clients"],
  "arguments": [{"display_text":"key","key_spec_index":0,"name":"key","type":"key"},{"arguments":[{"display_text":"nummembers","name":"nummembers","type":"integer"},{"display_text":"member","multiple":true,"name":"member","type":"string"}],"name":"members","token":"MEMBERS","type":"block"}],
  "syntax_fmt": "SEXPIRETIME key MEMBERS nummembers member [member ...]",
  "complexity": "O(N) where N is the number of specified members",
  "group": "set",
  "command_flags": ["readonly","fast"],
  "acl_categories": ["@read","@set","@fast"],
  "since": "8.12.0",
  "arity": -5,
  "key_specs": [{"RO":true,"access":true,"begin_search":{"spec":{"index":1},"type":"index"},"find_keys":{"spec":{"keystep":1,"lastkey":0,"limit":0},"type":"range"}}],
  "tableOfContents": {"sections":[{"id":"required-arguments","title":"Required arguments"},{"id":"examples","title":"Examples"},{"id":"redis-software-and-redis-cloud-compatibility","title":"Redis Software and Redis Cloud compatibility"},{"id":"return-information","title":"Return information"},{"id":"see-also","title":"See also"},{"id":"related-topics","title":"Related topics"}]}

,
  "codeExamples": []
}
```

Returns the absolute Unix timestamp, in seconds since the Unix epoch, at which one or more set members expire.

See also the [`SPEXPIRETIME`](https://redis.io/docs/latest/commands/spexpiretime) command, which returns the same information with millisecond resolution.

## Required arguments

<details open><summary><code>key</code></summary>

The name of the key that holds the set.

</details>

<details open><summary><code>MEMBERS nummembers member [member ...]</code></summary>

The set members to retrieve the expiration time for. `nummembers` is the number of members, followed by that many member names.

</details>

## Examples

```redis
redis> SADD myset member1 member2
(integer) 2
redis> SEXPIRE myset 300 MEMBERS 1 member1
1) (integer) 1
redis> SEXPIRETIME myset MEMBERS 3 member1 member2 member3
1) (integer) 1792684428
2) (integer) -1
3) (integer) -2
```

## Redis Software and Redis Cloud compatibility

| Redis<br />Software | Redis<br />Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> |
|:----------------------|:-----------------|:------|
| <span title="Not supported">&#x274c; Standard</span><br /><span title="Not supported"><nobr>&#x274c; Active-Active</nobr></span> | <span title="Not supported">&#x274c; Standard</span><br /><span title="Not supported"><nobr>&#x274c; Active-Active</nobr></span> |  |

## Return information

**RESP2:**

* [Array reply](https://redis.io/docs/latest/develop/reference/protocol-spec#arrays). For each member:
    - [Integer reply](https://redis.io/docs/latest/develop/reference/protocol-spec#integers): `-2` if no such member exists in the set, or the key does not exist.
    - [Integer reply](https://redis.io/docs/latest/develop/reference/protocol-spec#integers): `-1` if the member exists but has no associated expiration.
    - [Integer reply](https://redis.io/docs/latest/develop/reference/protocol-spec#integers): the expiration time, as a Unix timestamp in seconds.
* [Simple error reply](https://redis.io/docs/latest/develop/reference/protocol-spec#simple-errors):
    - if parsing failed, mandatory arguments are missing, unknown arguments are specified, or argument values are of the wrong type or out of range.
    - if the key exists but is not a set.

**RESP3:**

* [Array reply](https://redis.io/docs/latest/develop/reference/protocol-spec#arrays). For each member:
    - [Integer reply](https://redis.io/docs/latest/develop/reference/protocol-spec#integers): `-2` if no such member exists in the set, or the key does not exist.
    - [Integer reply](https://redis.io/docs/latest/develop/reference/protocol-spec#integers): `-1` if the member exists but has no associated expiration.
    - [Integer reply](https://redis.io/docs/latest/develop/reference/protocol-spec#integers): the expiration time, as a Unix timestamp in seconds.
* [Simple error reply](https://redis.io/docs/latest/develop/reference/protocol-spec#simple-errors):
    - if parsing failed, mandatory arguments are missing, unknown arguments are specified, or argument values are of the wrong type or out of range.
    - if the key exists but is not a set.



## See also

[`SEXPIRE`](https://redis.io/docs/latest/commands/sexpire) | [`SPEXPIRE`](https://redis.io/docs/latest/commands/spexpire) | [`SEXPIREAT`](https://redis.io/docs/latest/commands/sexpireat) | [`SPEXPIREAT`](https://redis.io/docs/latest/commands/spexpireat) | [`SADDEX`](https://redis.io/docs/latest/commands/saddex) | [`STTL`](https://redis.io/docs/latest/commands/sttl) | [`SPTTL`](https://redis.io/docs/latest/commands/spttl) | [`SPEXPIRETIME`](https://redis.io/docs/latest/commands/spexpiretime) | [`SPERSIST`](https://redis.io/docs/latest/commands/spersist)

## Related topics

- [Set member expiration](https://redis.io/docs/latest/develop/data-types/sets#member-expiration)

