O$: Date parts
Stephane Pras
stephane.pras at noos.fr
Tue Mar 14 06:12:56 EDT 2017
Franco,
I apologize for having submitted too simple a formula. You will find the
right one below:
Let¹s say that: A = dpart(kDayofWeek,date) B = PostGreSQL(blabla)
You must use: B = 6 + A - int((6+A)/7)*7
This formula works round the clock !!!
It is not Omnis programming, but arithmetic: evaluating a number modulo 7.
For a better understanding please note that 6 = 7 - 1 :-)
Stephane
From: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> on behalf of
Franco Maregotto <franco.maregotto at icloud.com>
Reply-To: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
Date: Monday, March 13, 2017 at 9:28 AM
To: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
Subject: Re: O$: Date parts
Stephane
Would be a good idea, assumed that nobody works on saturday!
your suggestion would do the trick from sunday to friday, but I should then
use a conditional to pick the saturday exception, and if I use the dpart
func in a calculation I'm fired again..
dpart(kDayofWeek,date): returns
Sun=1, Mon=2, .. Fri=6, Sat=0
PostGreSQL returns
Sun=0, Mon=1, .. Fri=5, Sat=6
> Il giorno 12 mar 2017, alle ore 17:34, Stephane Pras <stephane.pras at noos.fr>
> ha scritto:
>
> what about using dpart(kDayofWeek,date)-1 ???
>
> ...
>
> dpart(kDayofWeek,date)
_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com
More information about the omnisdev-en
mailing list