w3resource

Redis Server: TIME

Redis TIME Command

Redis TIME command is used to return the current server time as a two items lists: a Unix timestamp and the amount of microseconds already elapsed in the current second.

Here are some common uses and scenarios for the "TIME" command:

  • Current Time: Returns the current server time in Unix timestamp format, providing a way to get the current date and time from the Redis server.
  • Time Synchronization: Useful for synchronizing time-based operations or tasks with the server’s current time.
  • Performance Monitoring: Helps in performance monitoring by allowing time-based metrics and logging to be aligned with the server’s time.
  • Debugging: Assists in debugging by providing the server time, which can be useful for correlating logs and events.

Syntax:

TIME

Available since

2.6.0.

Return Value

A multi bulk reply containing two elements:

  • unix time in seconds.
  • microseconds.

Return Value Type

Integer

Example: Redis TIME

redis 127.0.0.1:6379> TIME 
1) "1410856598"
2) "928370"

Previous: SYNC
Next: Administration Backup and Restore



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/redis/redis-server-time.php