{
  "schema_version": 2,
  "id": "commands/pexpireat",
  "title": "PEXPIREAT",
  "url": "https://redis.io/docs/latest/commands/pexpireat/",
  "summary": "Sets the expiration time of a key to a Unix milliseconds timestamp.",
  "since": "2.6.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": "15d543edbdd5f5d78e18daa9860bd2f19b94a90fd5dc6746f29cadfd76b36c83",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "`PEXPIREAT` has the same effect and semantic as [`EXPIREAT`](https://redis.io/docs/latest/commands/expireat), but the Unix time at\nwhich the key will expire is specified in milliseconds 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 to set a timeout on.\n\n</details>\n\n<details open><summary><code>unix-time-milliseconds</code></summary>\n\nThe absolute Unix expiration timestamp, in milliseconds since Unix epoch. A timestamp in the past deletes the key immediately.\n\n</details>"
    },
    {
      "id": "optional-arguments",
      "title": "Optional arguments",
      "role": "parameters",
      "text": "The following options modify the command's behavior. They are mutually exclusive.\n\n<details open><summary><code>NX</code></summary>\n\nSet expiry only when the key has no expiry.\n\n</details>\n\n<details open><summary><code>XX</code></summary>\n\nSet expiry only when the key has an existing expiry.\n\n</details>\n\n<details open><summary><code>GT</code></summary>\n\nSet expiry only when the new expiry is greater than the current one. A non-volatile key is treated as an infinite TTL for the purpose of `GT`.\n\n</details>\n\n<details open><summary><code>LT</code></summary>\n\nSet expiry only when the new expiry is less than the current one. A non-volatile key is treated as an infinite TTL for the purpose of `LT`.\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "redis> SET mykey \"Hello\"\nOK\nredis> PEXPIREAT mykey 1555555555005\n(integer) 1\nredis> TTL mykey\n(integer) -2\nredis> PTTL mykey\n(integer) -2"
    },
    {
      "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): `1` if the timeout was set.\n* [Integer reply](../../develop/reference/protocol-spec#integers): `0` if the timeout was not set. For example, if the key doesn't exist, or the operation was skipped due to the provided arguments.\n\n**RESP3:**\n\nOne of the following:\n* [Integer reply](../../develop/reference/protocol-spec#integers): `1` if the timeout was set.\n* [Integer reply](../../develop/reference/protocol-spec#integers): `0` if the timeout was not set. For example, if the key doesn't exist, or the operation was skipped due to the provided arguments."
    }
  ],
  "examples": []
}
