Answer the question
In order to leave comments, you need to log in
How to get date as a percentage in Postgresql?
We switched to postgres, and some things that were easy to do in MySQL are not as easy to do in PostgreSQL.
There are two fields with datetime types (timestamp without gmt) - start date and end date. It is necessary to get as a percentage how much is left to reach the final date from the current time. In MySQL, this can be done with the following query:
select ((end_date - now()) * 100) / (end_date - begin_date) from table
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question