{
  "schema_version": 2,
  "id": "commands/hexpiretime",
  "title": "HEXPIRETIME",
  "url": "https://redis.io/docs/latest/commands/hexpiretime/",
  "summary": "Returns the expiration time of a hash field as a Unix timestamp, in seconds.",
  "since": "7.4.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-09-18T09:47:41+01:00",
  "page_type": "content",
  "content_hash": "86f15f141ed99f054855cd3b97d0fd7049cad20afc99b63f9ec061829e7d5403",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Returns the absolute Unix timestamp in seconds since Unix epoch at which the given key's field(s) will expire.\n\nSee also the [`HPEXPIRETIME`](https://redis.io/docs/latest/commands/hpexpiretime) 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 hash.\n\n</details>\n\n<details open><summary><code>FIELDS numfields field [field ...]</code></summary>\n\nThe hash fields to retrieve the expiration time for. `numfields` is the number of fields, followed by that many field names.\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "redis> HSET mykey field1 \"hello\" field2 \"world\"\n(integer) 2\nredis> HEXPIRE mykey 300  FIELDS 2 field1 field2\n1) (integer) 1\n2) (integer) 1\nredis> HEXPIRETIME mykey FIELDS 2 field1 field2\n1) (integer) 1715705914\n2) (integer) 1715705914"
    },
    {
      "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\n* [Array reply](../../develop/reference/protocol-spec#arrays). For each field:\n    - [Integer reply](../../develop/reference/protocol-spec#integers): `-2` if no such field exists in the provided hash key, or the provided key does not exist.\n    - [Integer reply](../../develop/reference/protocol-spec#integers): `-1` if the field exists but has no associated expiration set.\n    - [Integer reply](../../develop/reference/protocol-spec#integers): the expiration (Unix timestamp) in seconds.\n\n**RESP3:**\n\n* [Array reply](../../develop/reference/protocol-spec#arrays). For each field:\n    - [Integer reply](../../develop/reference/protocol-spec#integers): `-2` if no such field exists in the provided hash key, or the provided key does not exist.\n    - [Integer reply](../../develop/reference/protocol-spec#integers): `-1` if the field exists but has no associated expiration set.\n    - [Integer reply](../../develop/reference/protocol-spec#integers): the expiration (Unix timestamp) in seconds."
    }
  ],
  "examples": []
}
