Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lqKkp-0005fq-3r for pgsql-general@arkaria.postgresql.org; Mon, 07 Jun 2021 19:17:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lqKkn-0006Cj-7Z for pgsql-general@arkaria.postgresql.org; Mon, 07 Jun 2021 19:17:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lqKkm-0006Cb-Sb for pgsql-general@lists.postgresql.org; Mon, 07 Jun 2021 19:17:40 +0000 Received: from mail-ot1-x332.google.com ([2607:f8b0:4864:20::332]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lqKkk-00039J-SX for pgsql-general@lists.postgresql.org; Mon, 07 Jun 2021 19:17:40 +0000 Received: by mail-ot1-x332.google.com with SMTP id 69-20020a9d0a4b0000b02902ed42f141e1so17879240otg.2 for ; Mon, 07 Jun 2021 12:17:38 -0700 (PDT) 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-language; bh=3vSQdKax6k0MtwUxuBhbzMFPN6c/c8IZe6pSu68XxKQ=; b=aqKMErTBMMg4U9d558+ny6I3KJskqioAIyZh5bh+3scVvWfAzIvHXn4HWbUHL+CfUj 3vHPDr1IzDmImfNVj9qr5+n2RXyD9LsK6jZrTPIrT7tSop07e5xeubrcLvw0xVskKEAM lZxZ5lHGZ4AonuO6fqDaJplkYoAWxblQcsXH0WSQKsZ4n85r848/51RU+QDQXOsAXUdu D42LJmMTGdna/FfTQiUKg4Ml1AgemR+/fnmGapfZDQHkHfWsmS2nY6pion0ozGo/DwGQ kMU+Y9Xaqeaar20xXIX9kbHzk3nu7Wn7KuIQqvAID+/Uh5jvNaGiw+uP8rMEe7tD2F/4 2O2g== 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-language; bh=3vSQdKax6k0MtwUxuBhbzMFPN6c/c8IZe6pSu68XxKQ=; b=QgFqcFd/Obossi+O/N6b/LhJu6sdBC/UV7uSx2R0AVQB/AZpGWOhx7LbmPMIOTpP3z xR00W+V6iGvODyuwlOz1adAH3Cgqgs3CXwCJC4ouYVMGzJbYtHaJ3RIcC1o0AGIigKtq 114su8gBQ/0od0+YIhhTF1doC3Fiz87MMo5mBD10hguCXaJAW9F8T6RWVBsjAQ4E7Ezu ElROPjvjatYjxq+EEuPQjOOcco9b65Cpxk/G0u6+7CQYPvwW36t7KrC1zfVE35fFr4TW 8fP1Os+wMY6bIr28eHazsuz3zmxMaWwXr3nEib0Ok8pbfVsUeQVVNDeM2A91gpp2siX+ 6OqA== X-Gm-Message-State: AOAM530M2aCk2Oqreh9UcXK8ca/tzPF6XY1uBN+q7JsNa23xDulgEJPV BwEtsB5sppn5PYUk6ICvogp7/9Wz+fVpNA== X-Google-Smtp-Source: ABdhPJyUixlj5DXd24T+xOXng1/Oxe1JL0wyFgJvccoYNGJdLWSrBVZZOVAPv1hbf84+PUXhO3lDlw== X-Received: by 2002:a05:6830:3115:: with SMTP id b21mr14466137ots.234.1623093457019; Mon, 07 Jun 2021 12:17:37 -0700 (PDT) Received: from [192.168.88.10] (ip174-67-141-204.no.no.cox.net. [174.67.141.204]) by smtp.googlemail.com with ESMTPSA id e11sm2513903otk.78.2021.06.07.12.17.36 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Jun 2021 12:17:36 -0700 (PDT) Subject: Re: Need to omit time during weekends from age calculations To: pgsql-general@lists.postgresql.org References: From: Ron Message-ID: <55a3b160-8ccf-ca96-f654-1dcc6cf3b8d7@gmail.com> Date: Mon, 7 Jun 2021 14:17:35 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------D64AE0A016452505D261AED6" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------D64AE0A016452505D261AED6 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 6/7/21 2:12 PM, David Gauthier wrote: > Hi: > > I suspect I'm not the first to ask about this but couldn't find anything > after googling for a bit.  So here goes.... > > I'd like to get the "age" difference between two times which span either > all or part of a weekend but exclude any time that transpired during the > weekend. > Example (please pardon the non-timestamp vals here...) > > age('Monday-Noon','Prev-Friday-Noon') > would give me '1 day'. > > ...and... > > age('Sunday-Noon','Prev-Friday-Noon') > would give me '12 hours' > > You get the picture. > > Has this wheel already been invented ? > I don't see an easy way to do this off-hand. > All Ears :-) > > Thanks in Advance. You seem to be asking about counting work days.  Am I misunderstanding? -- Angular momentum makes the world go 'round. --------------D64AE0A016452505D261AED6 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit On 6/7/21 2:12 PM, David Gauthier wrote:
Hi:

I suspect I'm not the first to ask about this but couldn't find anything after googling for a bit.  So here goes....

I'd like to get the "age" difference between two times which span either all or part of a weekend but exclude any time that transpired during the weekend.  
Example (please pardon the non-timestamp vals here...)

age('Monday-Noon','Prev-Friday-Noon')
would give me '1 day'.

...and...

age('Sunday-Noon','Prev-Friday-Noon')
would give me '12 hours'

You get the picture. 

Has this wheel already been invented ?
I don't see an easy way to do this off-hand.
All Ears :-)

Thanks in Advance.

You seem to be asking about counting work days.  Am I misunderstanding?

--
Angular momentum makes the world go 'round.
--------------D64AE0A016452505D261AED6--