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 1i2jwK-0007DR-Oj for pgsql-general@arkaria.postgresql.org; Tue, 27 Aug 2019 22:27:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i2jwJ-0004vd-GO for pgsql-general@arkaria.postgresql.org; Tue, 27 Aug 2019 22:27:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i2jwJ-0004qw-4O for pgsql-general@lists.postgresql.org; Tue, 27 Aug 2019 22:27:47 +0000 Received: from mailbackend.panix.com ([166.84.1.89]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i2jwG-0007sc-Hd for pgsql-general@postgresql.org; Tue, 27 Aug 2019 22:27:46 +0000 Received: from panix2.panix.com (panix2.panix.com [166.84.1.2]) by mailbackend.panix.com (Postfix) with ESMTP id 46J3R21PWWz1DWF for ; Tue, 27 Aug 2019 18:27:42 -0400 (EDT) Received: by panix2.panix.com (Postfix, from userid 17622) id 46J3R172M6z1ZVM; Tue, 27 Aug 2019 18:27:41 -0400 (EDT) Date: Tue, 27 Aug 2019 18:27:41 -0400 From: stan To: pgsql-general@postgresql.org Subject: Work hours? Message-ID: <20190827222741.GB19306@panix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Editor: gVim User-Agent: Mutt/1.12.1 (2019-06-15) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I am just starting to explore the power of PostgreSQL's time and date functionality. I must say they seem very powerful. I need to write a function that, given a month, and a year as input returns the "work hours" in that month. In other words something like 8 * the count of all days in the range Monday to Friday) within that calendar month. Any thoughts as to the best way to approach this? -- "They that would give up essential liberty for temporary safety deserve neither liberty nor safety." -- Benjamin Franklin