{
  "schema_version": 2,
  "id": "commands/hpexpiretime",
  "title": "HPEXPIRETIME",
  "url": "https://redis.io/docs/latest/commands/hpexpiretime/",
  "summary": "Returns the expiration time of a hash field as a Unix timestamp, in msec.",
  "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": "60c4f66626feb000e0e6f4d1e28b670984f8c79df3dbbfb3251dafd921b23760",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "`HPEXPIRETIME` has the same semantics as [`HEXPIRETIME`](https://redis.io/docs/latest/commands/hexpiretime), but returns the absolute Unix expiration timestamp in milliseconds since Unix epoch instead of seconds."
    },
    {
      "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": "[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=\"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 milliseconds.\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 milliseconds."
    }
  ],
  "examples": [
    {
      "id": "examples-ex0",
      "language": "plaintext",
      "code": "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> HPEXPIRETIME mykey FIELDS 2 field1 field2\n1) (integer) 1715705913659\n2) (integer) 1715705913659",
      "section_id": "examples"
    }
  ]
}
