From: Bruce Momjian <bruce@momjian.us>
To: Ron <ronljohnsonjr@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Date calculation
Date: Thu, 31 Jan 2019 15:15:14 -0500
Message-ID: <20190131201514.GA3377@momjian.us> (raw)
In-Reply-To: <c10b17de-623b-4af3-8a8c-45c4a3a5826d@gmail.com>
References: <c10b17de-623b-4af3-8a8c-45c4a3a5826d@gmail.com>
On Thu, Jan 31, 2019 at 02:11:14PM -0600, Ron wrote:
> Hi,
>
> v9.6.6
>
> Is there a built in function to calculate, for example, next Sunday?
>
> For example,
>
> postgres=# select current_date, next_dow(current_date, 'Sunday');
> date | date
> ------------|------------
> 2019-01-31 | 2019-02-03
> (1 row)
Uh, this worked:
SELECT date_trunc('week', CURRENT_TIMESTAMP) + '6 days';
?column?
------------------------
2019-02-03 00:00:00-05
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: bruce@momjian.us, ronljohnsonjr@gmail.com
Subject: Re: Date calculation
In-Reply-To: <20190131201514.GA3377@momjian.us>
References: <c10b17de-623b-4af3-8a8c-45c4a3a5826d@gmail.com> <20190131201514.GA3377@momjian.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox