In Redis, how do I get the expiration date of a key?

Solution 1:

TTL key

See the documentation of the TTL command.

There is also a PTTL command since Redis 2.6 that returns the amount of time in milliseconds instead of seconds.