{
  "schema_version": 2,
  "id": "commands/sexpiretime",
  "title": "SEXPIRETIME",
  "url": "https://redis.io/docs/latest/commands/sexpiretime/",
  "summary": "Returns the expiration time of a set member as a Unix timestamp, in seconds.",
  "since": "8.12.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-11-23T06:19:08-08:00",
  "page_type": "content",
  "content_hash": "7131bd04fe5253c91eca5ac3a736c0d5bcaf7d0b3192b0c6cbb33ace77d3884d",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Returns the absolute Unix timestamp, in seconds since the Unix epoch, at which one or more set members expire.\n\nSee also the [`SPEXPIRETIME`](https://redis.io/docs/latest/commands/spexpiretime) command, which returns the same information with millisecond resolution."
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>key</code></summary>\n\nThe name of the key that holds the set.\n\n</details>\n\n<details open><summary><code>MEMBERS nummembers member [member ...]</code></summary>\n\nThe set members to retrieve the expiration time for. `nummembers` is the number of members, followed by that many member names.\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "[code example]"
    },
    {
      "id": "redis-software-and-redis-cloud-compatibility",
      "title": "Redis Software and Redis Cloud compatibility",
      "role": "content",
      "text": "| Redis<br />Software | Redis<br />Cloud | <span style=\"min-width: 9em; display: table-cell\">Notes</span> |\n|:----------------------|:-----------------|:------|\n| <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> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\n* [Array reply](https://redis.io/docs/latest/develop/reference/protocol-spec#arrays). For each member:\n    - [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.\n    - [Integer reply](https://redis.io/docs/latest/develop/reference/protocol-spec#integers): `-1` if the member exists but has no associated expiration.\n    - [Integer reply](https://redis.io/docs/latest/develop/reference/protocol-spec#integers): the expiration time, as a Unix timestamp in seconds.\n* [Simple error reply](https://redis.io/docs/latest/develop/reference/protocol-spec#simple-errors):\n    - if parsing failed, mandatory arguments are missing, unknown arguments are specified, or argument values are of the wrong type or out of range.\n    - if the key exists but is not a set.\n\n**RESP3:**\n\n* [Array reply](https://redis.io/docs/latest/develop/reference/protocol-spec#arrays). For each member:\n    - [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.\n    - [Integer reply](https://redis.io/docs/latest/develop/reference/protocol-spec#integers): `-1` if the member exists but has no associated expiration.\n    - [Integer reply](https://redis.io/docs/latest/develop/reference/protocol-spec#integers): the expiration time, as a Unix timestamp in seconds.\n* [Simple error reply](https://redis.io/docs/latest/develop/reference/protocol-spec#simple-errors):\n    - if parsing failed, mandatory arguments are missing, unknown arguments are specified, or argument values are of the wrong type or out of range.\n    - if the key exists but is not a set."
    },
    {
      "id": "see-also",
      "title": "See also",
      "role": "related",
      "text": "[`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)"
    },
    {
      "id": "related-topics",
      "title": "Related topics",
      "role": "related",
      "text": "- [Set member expiration](https://redis.io/docs/latest/develop/data-types/sets#member-expiration)"
    }
  ],
  "examples": [
    {
      "id": "examples-ex0",
      "language": "redis",
      "code": "redis> SADD myset member1 member2\n(integer) 2\nredis> SEXPIRE myset 300 MEMBERS 1 member1\n1) (integer) 1\nredis> SEXPIRETIME myset MEMBERS 3 member1 member2 member3\n1) (integer) 1792684428\n2) (integer) -1\n3) (integer) -2",
      "section_id": "examples"
    }
  ]
}
