Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gpIqW-0007BX-KM for pgsql-general@arkaria.postgresql.org; Thu, 31 Jan 2019 20:22:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gpIqU-0002Ls-IB for pgsql-general@arkaria.postgresql.org; Thu, 31 Jan 2019 20:21:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gpIqU-0002J8-2G for pgsql-general@lists.postgresql.org; Thu, 31 Jan 2019 20:21:58 +0000 Received: from mail-ot1-x344.google.com ([2607:f8b0:4864:20::344]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gpIqR-0008QQ-Ik for pgsql-general@postgresql.org; Thu, 31 Jan 2019 20:21:56 +0000 Received: by mail-ot1-x344.google.com with SMTP id n8so4006977otl.6 for ; Thu, 31 Jan 2019 12:21:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=ERtyidNvpxktC++wjA54Hwy0HYiCgK6efKrxFpfvuWI=; b=svLSyk9KIBMnWnnzziUE4x6sYDolqJzwtWvFiAMRRIiDuXozCfQpJLCwb7kV0Hyww/ pZiGFBvypSP6tRD6NFLGLrAIGb9pdk+xNzDxpaGkceY8KEUyfVwM19RQCIZMxHBLxR2V B0h79ywGxKSIAKdWTyzPplPD5qYctasR0Bf1fFvw7DSuRl+FnA/p5iIdbnW+SUn8dQjw GDK1B3cJ/v1d+7V/3JSsD4+Zhr2OS1xU1Fj4BN+n4b7l85jHt8j6RGb6IQiTCZ1RfdVb aDb+1QM8clLWXRG9hL5cN2TvZ842f7gCSspj09lF/Re1ITSB1tP/DlQQI/iGeyCPoVlB DQbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=ERtyidNvpxktC++wjA54Hwy0HYiCgK6efKrxFpfvuWI=; b=FfOfsz5VGlqKrCCa0Mtq2wakbf67yB/vNEcSCnLJilayIsKW1KWuvSrGNALDFD+x0f F4Dq7MNowjMjoyd+5M7MzScia5wlsZ9ZcMXRWOSFsSUrdMZnmxEIQKC1HEjmMgkDGtDm fqzCoUg+TvVpvP7W2aH2zhuDL3Z57LYMR+lF4lA7zjIvyOWdX/6pCuwueIxaER6Op9JE 5iBFACwxnpsytYxzv+9PQ9cMaxOkViX34tNiC72tIxk8ABIPRCout6ljOZe/Oe5eDXFY 3WYcBNGnR8X9A8oE05BNu+5QIHauCtMnuhxyhtxk0d3EwE4EizzxH3bUzxTXQedRH1Pk sg6g== X-Gm-Message-State: AJcUukevV0SSK+uEy0ir8nZonnB3xGtVm/k2KNrREqQQ/7Iww+EQmhcN WnptOTZfWloy4RNnxXxsuREXWWMK X-Google-Smtp-Source: ALg8bN75y20WbesgqokogId81oeQsV6WCTkopZekbyBeLzxMyGW2qz86RHv1oB5CJKOrJgNTKXl2iw== X-Received: by 2002:a9d:6287:: with SMTP id x7mr26266894otk.304.1548966114714; Thu, 31 Jan 2019 12:21:54 -0800 (PST) Received: from [192.168.1.10] (ip70-171-116-89.no.no.cox.net. [70.171.116.89]) by smtp.googlemail.com with ESMTPSA id g138sm2883704oib.26.2019.01.31.12.21.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Jan 2019 12:21:53 -0800 (PST) Subject: Re: Date calculation To: pgsql-general@postgresql.org References: <20190131201514.GA3377@momjian.us> From: Ron Message-ID: <24e5ee21-0b9f-e3c8-2553-817813a04593@gmail.com> Date: Thu, 31 Jan 2019 14:21:52 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190131201514.GA3377@momjian.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 1/31/19 2:15 PM, Bruce Momjian wrote: > 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 Perfect!  All I had to do was cast that as DATE... Thanks -- Angular momentum makes the world go 'round.