postgresql - SQL Count days till first of the month -
postgresql - SQL Count days till first of the month -
how count days date till first of next month
example:
--start date 07-07-2011 how many days till:
-- 1st of succeeding month of start date above 08-01-2011 expected result (in days):
25 so if counted day 25, running query gets me desired timestamp:
select current_date + interval '25 days' results:
2011-08-01 00:00:00 just can't think of way number of days, suggestions?
or start date, end date, number of days between?
i don't have postgresql server handy, untested, try:
select (date_trunc('month', current_date) + interval '1 month') - current_date sql postgresql datetime
Comments
Post a Comment