ncd
ncd

Reputation: 1

How to store current datetime data in Redis Server

I would like to store data like this in Redis #SET datetime:1 "Login time [date] and in hour is [current time]"

How to replace the content in brackets? As we know in SQL we can use getdate() function, but how in Redis?

Upvotes: 0

Views: 3787

Answers (1)

noscreenname
noscreenname

Reputation: 3370

There is TIME command, but it won't work if you simply pass it as a parameter to SET. You can either to do it programatically in whatever language you are using. Or with a Lua script using EVAL command.

Upvotes: 2

Related Questions