{
  "schema_version": 2,
  "id": "commands/expiretime",
  "title": "EXPIRETIME",
  "url": "https://redis.io/docs/latest/commands/expiretime/",
  "summary": "Returns the expiration time of a key as a Unix timestamp.",
  "since": "7.0.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-09-18T09:48:32+01:00",
  "page_type": "content",
  "content_hash": "dd68643967ee8c67673804e77e75bebf31e0ba8fcce22d1b5e3a78a9c74b3526",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Returns the absolute Unix timestamp (since January 1, 1970) in seconds at which the given key will expire.\n\nSee also the [`PEXPIRETIME`](https://redis.io/docs/latest/commands/pexpiretime) command which returns the same information with milliseconds resolution."
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>key</code></summary>\n\nThe name of the key.\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "redis> SET mykey \"Hello\"\nOK\nredis> EXPIREAT mykey 33177117420\n(integer) 1\nredis> EXPIRETIME mykey\n(integer) 33177117420"
    },
    {
      "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=\"Supported\">&#x2705; Standard</span><br /><span title=\"Supported\"><nobr>&#x2705; Active-Active</nobr></span> | <span title=\"Supported\">&#x2705; Standard</span><br /><span title=\"Supported\"><nobr>&#x2705; Active-Active</nobr></span> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\nOne of the following:\n* [Integer reply](../../develop/reference/protocol-spec#integers): the expiration Unix timestamp in seconds.\n* [Integer reply](../../develop/reference/protocol-spec#integers): `-1` if the key exists but has no associated expiration time.\n* [Integer reply](../../develop/reference/protocol-spec#integers): `-2` if the key does not exist.\n\n**RESP3:**\n\nOne of the following:\n* [Integer reply](../../develop/reference/protocol-spec#integers): the expiration Unix timestamp in seconds.\n* [Integer reply](../../develop/reference/protocol-spec#integers): `-1` if the key exists but has no associated expiration time.\n* [Integer reply](../../develop/reference/protocol-spec#integers): `-2` if the key does not exist."
    }
  ],
  "examples": []
}
