SQL(Postgres):直到下个月的时间 [英] SQL (Postgres): Time until next month
本文介绍了SQL(Postgres):直到下个月的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我有一个时间戳,如何计算该月的剩余时间(以天/小时为单位)?
suppose I have a timestamp, how can I calculate the month's remaining time (in days/hours) ?
推荐答案
postgres=# select date_trunc('month', now() + interval '1 month') - now();
?column?
-------------------------
23 days 05:59:12.486972
(1 row)
这篇关于SQL(Postgres):直到下个月的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文