Answer the question
In order to leave comments, you need to log in
How to make time for postgresql?
I want to make a loan in a tg bot with a return - 3 days. How to make it so that every second all users who have a credit take a second? Can this be done in postgresql? Or how? (if my bot is on the server)
Answer the question
In order to leave comments, you need to log in
Record the date and time of the loan repayment in the database. And when outputting data to the user - calculate the rest of the time.
Record the time of issue (well, let it be created_at) and return (expired_at) of the loan in timestamptz
second as alter table my_table add expired_at timestamptz generated always as ( created_at + interval '3 day');
Then look for rotten ones through select * where is_payed=false and
expired_at
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question