: Re: [U2] End of Month date routine
On UV the vlist would indicate yes (the complete expression is processed) .
LEAP.YEAR = NOT(MOD(YEAR,4)) AND (NOT(MOD(YEAR,400)) OR MOD(YEAR,100))
00062 : 0F6 mod YEAR 4 = $R1
0006A : 10E not $R1 = $R2
00070 : 0F6 mod YEAR 400
, December 06, 2011 4:22 PM
To: U2 Users List
Subject: Re: [U2] End of Month date routine
Leap years are a little more complex than MOD(YEAR,4)
From http://en.wikipedia.org/wiki/Leap_years#Algorithm
if year modulo 4 is 0
then
if year modulo 100 is 0
then
if year modulo
Try this routine:
SUBROUTINE RPT_DATES(OUT.DATES, IN.DATES, IN.DATE.TYPE, FLAG)
* DAG_DATES - By David A. Green -- 1Jun05
* www.dagconsulting.com
*
* Calculate dates and date ranges
*
** Inputs:
*IN.DATES - Single or Multivalued List of Dates as
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of David A. Green
Sent: Wednesday, December 07, 2011 8:25 AM
To: 'U2 Users List'
Subject: Re: [U2] End of Month date routine
YEAR = OCONV(PASS.DATE, DY)
TEST = ICONV(Feb 29 :YEAR, D)
LEAP.YEAR = (STATUS() = 0)
David A. Green
(480) 813-1725
DAG
@listserver.u2ug.org
Sent: Wed, Dec 7, 2011 7:28 am
Subject: Re: [U2] End of Month date routine
Try this routine:
SUBROUTINE RPT_DATES(OUT.DATES, IN.DATES, IN.DATE.TYPE, FLAG)
* DAG_DATES - By David A. Green -- 1Jun05
* www.dagconsulting.com
*
* Calculate dates and date ranges
-Original Message-
From: Daniel McGrath dmcgr...@rocketsoftware.com
To: U2 Users List u2-users@listserver.u2ug.org
Sent: Wed, Dec 7, 2011 8:02 am
Subject: Re: [U2] End of Month date routine
Perfectly fine except if you need to run this is a very large loop (such as
atch processing 100
Who wants to take each of the Leap Year calculations and put them into
different subroutines and loop 100K times and see which one is faster using
profiling?
David A. Green
(480) 813-1725
DAG Consulting
___
U2-Users mailing list
, 2011 10:29 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] End of Month date routine
This algorithm is redundant and also fails to take into account the Boolean
nature of the terms and thus adds extra unneeded op codes in the compare to 0
and compare to 1 steps. Below is the equivalent
Because ?
-Original Message-
From: Daniel McGrath dmcgr...@rocketsoftware.com
To: U2 Users List u2-users@listserver.u2ug.org
Sent: Wed, Dec 7, 2011 10:22 am
Subject: Re: [U2] End of Month date routine
That doesn't give the correct results, although removing the comparisons with 0
ill
Oops, maybe all those Mods in my code are supposed to be... NOT(MOD...
Just maybe
-Original Message-
From: Daniel McGrath dmcgr...@rocketsoftware.com
To: U2 Users List u2-users@listserver.u2ug.org
Sent: Wed, Dec 7, 2011 10:22 am
Subject: Re: [U2] End of Month date routine
LEAP.YEAR needs to be FALSE at the start
-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: 07 December 2011 18:49
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] End of Month date routine
Because
-boun...@listserver.u2ug.org] On Behalf Of David A. Green
Sent: Wednesday, December 07, 2011 10:48 AM
To: 'U2 Users List'
Subject: Re: [U2] End of Month date routine
Who wants to take each of the Leap Year calculations and put them into
different subroutines and loop 100K times and see which one
FOR THE LAST DAY OF THE MONTH
-Original Message-
From: Marco Antonio Rojas Castro [mailto:marco_roja...@hotmail.com]
Sent: Monday, December 05, 2011 3:49 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] End of Month date routine
TODAY = DATE()
EOM = TODAY - TODAYDD + 32
EOM = EOM - EOMDD
-
From: Daniel McGrath [mailto:dmcgr...@rocketsoftware.com]
Sent: Wednesday, December 07, 2011 11:57 AM
To: dgr...@dagconsulting.com; U2 Users List
Subject: RE: [U2] End of Month date routine
I added the code to PasteBin so as to not flood here:
http://pastebin.com/JMyqhFud
I did a few more than
...@rocketsoftware.com; 'U2 Users List'
u2-users@listserver.u2ug.org
Sent: Wed, Dec 7, 2011 12:23 pm
Subject: Re: [U2] End of Month date routine
Okay I took the fastest routine and made it into an $INSERT piece of code:
YEAR = OCONV(THE.DATE, DY)
F MOD(YEAR,4) THEN
LEAP.YEAR = 0
ND ELSE
IF MOD(YEAR
And seeing how this thread is petering out how about this alternative:
meDate = date()
currentMonth = oconv(meDate,'dm')
loop while oconv(meDate + 1,'dm') = curMonth do meDate += 1 repeat
Personally I vote for Marco's solution, though it may need brackets or an
,
Andy
From: Daniel McGrath dmcgr...@rocketsoftware.com
To: dgr...@dagconsulting.com dgr...@dagconsulting.com; U2 Users List
u2-users@listserver.u2ug.org
Sent: Wednesday, 7 December 2011, 18:57
Subject: Re: [U2] End of Month date routine
I added the code to PasteBin so as to not flood here
...@rocketsoftware.com
To: dgr...@dagconsulting.com dgr...@dagconsulting.com; U2 Users List
u2-users@listserver.u2ug.org
Sent: Wednesday, 7 December 2011, 18:57
Subject: Re: [U2] End of Month date routine
I added the code to PasteBin so as to not flood here:
http://pastebin.com/JMyqhFud
I did
To: 'Daniel McGrath' dmcgr...@rocketsoftware.com; 'U2 Users List'
u2-users@listserver.u2ug.org
Sent: Wednesday, 7 December 2011, 20:23
Subject: Re: [U2] End of Month date routine
Okay I took the fastest routine and made it into an $INSERT piece of code:
YEAR = OCONV(THE.DATE, DY)
IF MOD(YEAR,4
Sent: Wed, Dec 7, 2011 7:25 pm
Subject: Re: [U2] End of Month date routine
Seem to have lost a bit of last reply which should have read
Ran Dan's test code on latest Windows PE version of Universe and got :-
9.788
1.558
1.474
3.412
Tried
NOT(MOD(YEAR,400)) OR(NOT(MOD(YEAR,4)) AND MOD(YEAR,100
To: andyb...@yahoo.co.uk; u2-users@listserver.u2ug.org
Subject: Re: [U2] End of Month date routine
Why couldn't you say
LEAP.YEAR = NOT(MOD(YEAR,4)) AND (NOT(MOD(YEAR,400)) OR MOD(YEAR,100))
Would the system process the whole line even on an initial finding of False ?
-Original
December 2011 15:02
To: andyb...@yahoo.co.uk; u2-users@listserver.u2ug.org
Subject: Re: [U2] End of Month date routine
Why couldn't you say
LEAP.YEAR = NOT(MOD(YEAR,4)) AND (NOT(MOD(YEAR,400)) OR MOD(YEAR,100))
Would the system process the whole line even on an initial finding of False
That's better. It wasn't the ';' in the last one that caused the problem -
especially with a generic routine - it was the reliance on the date format
being m/d/y (which Dave's original noted).
Not sure why you're trying so hard to compress the lines. This routine will
easily fit in pretty much
List u2-users@listserver.u2ug.org
Sent: Mon, Dec 5, 2011 5:00 pm
Subject: Re: [U2] End of Month date routine
Just for laughs, the following works with only a single date conversion, though
will admit that it gets a little too obscure to be considered maintainable.
dmittedly, there are probably
...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of John
Hatherill
Sent: Tuesday, December 06, 2011 3:33 PM
To: U2 Users List
Subject: Re: [U2] End of Month date routine
Tdate = OCONV(DATE(),D4-)
mm1= Tdate[1,2]+1
1 = Tdate[7,4]
if mm1 12 then
mm1 = 01
1 += 1
end
EDATE
Sent: Tuesday, December 06, 2011 2:34 PM
To: U2 Users List
Subject: Re: [U2] End of Month date routine
Someone has probably already suggested one like this but I use:
DATE = ICONV(2-11-11,'D')
MONTH = OCONV(DATE,DM)
YEAR = OCONV(DATE,DY)
MONTH += 1
IF MONTH 12 THEN
MONTH = 1
YEAR += 1
END
: Re: [U2] End of Month date routine
Your method is also the way I've always done it, but an alternate method just
came to mind:
MONTH = OCONV(DATE, 'DM')
YEAR = OCONV(DATE, 'D Y[Z4]')
LEAP = MOD(YEAR, 4) = 0
MONTHS = ''
MONTHS1 = 31
MONTHS2 = 28 + LEAP
MONTHS3 = 31
MONTHS4 = 30
MONTHS5 = 31
MONTHS6
: Tuesday, December 06, 2011 2:34 PM
o: U2 Users List
ubject: Re: [U2] End of Month date routine
Someone has probably already suggested one like this but I use:
DATE = ICONV(2-11-11,'D')
ONTH = OCONV(DATE,DM)
EAR = OCONV(DATE,DY)
ONTH += 1
F MONTH 12 THEN
ONTH = 1
EAR += 1
ND
LAST.DAY = ICONV(MONTH:/1
Mr Castro's code wins. Pure elegance.
Marco Antonio Rojas Castro - initials M.A.R.C.
My uncle's name is Roy Owen Young - I tease him it's so he can remember it.
Regards, Keith
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
Month = Oconv(current.date,'DM') ;* find month
Year = Oconv(current.date,'DY') ;* find year
Month = Month + 1 ;* find next month
If (Month 12) then
Month = 1
Year = Year + 1
End
FirstDayNextMonth = Iconv(Month:/01/:Year,'D') ;* assumes MM/DD/ format
LastDayThisMonth = FirstDayNextMonth
Using NEXT.MONTH and proper YEAR:
ICONV(NEXT.MONTH:'/01/':YEAR)-1
will make the trick.
HP
On Mon, Dec 5, 2011 at 2:03 PM, Wjhonson wjhon...@aol.com wrote:
Does someone have a routine that, no matter what day you run it, returns
the End of Month Date ?
(Assume the end of month date, is
This may not be the cleanest way, but, we use it here and it works.
I used ABORT, so some parent program or paragraph would not keep executing.
IF FIELD(OCONV(DATE()+1,D2/),/,2) + 0 = 1 THEN
CRT 'This IS the last day of the month.'
CRT 'ABORTING END OF DAY'
ABORT
is '01'
-Original Message-
From: John Thompson jthompson...@gmail.com
To: U2 Users List u2-users@listserver.u2ug.org
Sent: Mon, Dec 5, 2011 11:16 am
Subject: Re: [U2] End of Month date routine
This may not be the cleanest way, but, we use it here and it works.
used ABORT, so some parent
Here's one I use.
TODAY = OCONV(DATE(), D4/)
MO = FIELD(TODAY, /, 1)
YR = FIELD(TODAY, /, 3)
MO += 1
IF MO 12 THEN
MO = 1
YR += 1
END
EOM = OCONV((ICONV(MO:/:1:YR) - 1), D4/)
Charles Shaffer
Senior Analyst
NTN-Bower Corporation
From: Wjhonson wjhon...@aol.com
To:
: Monday, December 05, 2011 2:22 PM
To: U2 Users List
Subject: Re: [U2] End of Month date routine
Here's one I use.
TODAY = OCONV(DATE(), D4/)
MO = FIELD(TODAY, /, 1)
YR = FIELD(TODAY, /, 3)
MO += 1
IF MO 12 THEN
MO = 1
YR += 1
END
EOM = OCONV((ICONV(MO:/:1:YR) - 1), D4/)
Charles Shaffer
Senior
Thanks to everyone who responded
This is with what I ended up
MONTH = OCONV(DATE(),'DM') ; YEAR = OCONV(DATE(),'DY')
IF MONTH = 12 THEN MONTH = 1 ; YEAR += 1 ELSE MONTH += 1
FIRST.OF.MONTH = ICONV(MONTH:/01/:YEAR,'D')
END.OF.MONTH.DATE = FIRST.OF.MONTH-1
The only
On 05/12/11 19:03, Wjhonson wrote:
Does someone have a routine that, no matter what day you run it, returns the
End of Month Date ?
(Assume the end of month date, is the calendar end of month date not some
screwy business date)
Hmmm... no-one seems to have done my approach ...
TODAY =
, December 05, 2011 3:05 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] End of Month date routine
On 05/12/11 19:03, Wjhonson wrote:
Does someone have a routine that, no matter what day you run it, returns the
End of Month Date ?
(Assume the end of month date, is the calendar end of month
or whatever
but it's not working
-Original Message-
From: George Gallen ggal...@wyanokegroup.com
To: U2 Users List u2-users@listserver.u2ug.org
Sent: Mon, Dec 5, 2011 12:10 pm
Subject: Re: [U2] End of Month date routine
Haven't checked it, but what happens on 01/31 by adding 31, it should take
...@listserver.u2ug.org] On Behalf Of George Gallen
Sent: Monday, December 05, 2011 3:10 PM
To: U2 Users List
Subject: Re: [U2] End of Month date routine
Haven't checked it, but what happens on 01/31 by adding 31, it should
take you March, backing up
Will give you 02/xx (28 or 29)?
George
...@listserver.u2ug.org] On Behalf Of Dave Laansma
Sent: Monday, December 05, 2011 3:21 PM
To: U2 Users List
Subject: Re: [U2] End of Month date routine
Ditto.
Sincerely,
David Laansma
IT Manager
Hubbard Supply Co.
Direct: 810-342-7143
Office: 810-234-8681
Fax: 810-234-6142
www.hubbardsupply.com
Delivering
But that would break the rhyme... :o
-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of George Gallen
Sent: December-05-11 12:26 PM
To: U2 Users List
Subject: Re: [U2] End of Month date routine
Damn February...We need
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Robert Houben
Sent: Monday, December 05, 2011 3:30 PM
To: U2 Users List
Subject: Re: [U2] End of Month date routine
But that would break the rhyme... :o
-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun
TODAY = DATE()
EOM = TODAY - TODAYDD + 32
EOM = EOM - EOMDD
To: u2-users@listserver.u2ug.org
From: wjhon...@aol.com
Date: Mon, 5 Dec 2011 15:16:02 -0500
Subject: Re: [U2] End of Month date routine
Doesn't work on my system Anthony.
The This month o gives the month and year ok
Doesn't work for me :( Tried on UD 7.1.6 and UD 6.0.12.
It works for December, but I changed it to March and it gave me January 3rd.
UniData does have a nice function LAST_DAY(x) for using in virtual
attributes to return the last day of the month for the date passed to it.
hth
Colin
Calgary,
...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Marco Antonio
Rojas Castro
Sent: Monday, December 05, 2011 3:49 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] End of Month date routine
TODAY = DATE()
EOM = TODAY - TODAYDD + 32
EOM = EOM - EOMDD
To: u2-users
)
Date: Mon, 5 Dec 2011 15:52:40 -0500
From: dlaan...@hubbardsupply.com
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] End of Month date routine
No, this will fail on January 31st, every year.
Sincerely,
David Laansma
IT Manager
Hubbard Supply Co.
Direct: 810-342-7143
Office: 810-234
Behalf Of Wols Lists
ent: Monday, December 05, 2011 3:05 PM
o: u2-users@listserver.u2ug.org
ubject: Re: [U2] End of Month date routine
On 05/12/11 19:03, Wjhonson wrote:
Does someone have a routine that, no matter what day you run it, returns the
nd of Month Date ?
(Assume the end of month
Listu2-users@listserver.u2ug.org
Sent: Mon, Dec 5, 2011 12:10 pm
Subject: Re: [U2] End of Month date routine
Haven't checked it, but what happens on 01/31 by adding 31, it should take you
arch, backing up
Will give you 02/xx (28 or 29)?
George
-Original Message-
rom: u2-users-boun
Of Charlie Noah
Sent: Monday, December 05, 2011 4:27 PM
To: U2 Users List
Subject: Re: [U2] End of Month date routine
I vote for the method (already posted) which will work every time on any
MV system, any flavor, any emulation: find the first day of the next
month and subtract 1. Messing around with adding
List'
Subject: Re: [U2] End of Month date routine
Agreed. That code is almost verbatim what I have used for 20+ years, and it
has never failed me.
John Israel
Senior ERP Developer
Dayton Superior Corporation
1125 Byers Rd Miamisburg, OH 45342
Office: 937-866-0711 x44380
Actually that will not work for a date near the end of the month. Was trying to
be too smart
-Original Message-
From: Phil Walker
Sent: Tuesday, 6 December 2011 10:47 a.m.
To: 'U2 Users List'
Subject: RE: [U2] End of Month date routine
EOM = OCONV(ICONV(OCONV(@DATE+31,'D-YM
: [U2] End of Month date routine
Doesn't work for me :( Tried on UD 7.1.6 and UD 6.0.12.
It works for December, but I changed it to March and it gave me January 3rd.
UniData does have a nice function LAST_DAY(x) for using in virtual
ttributes to return the last day of the month for the date passed
: Marco Antonio Rojas Castro marco_roja...@hotmail.com
To: u2-users u2-users@listserver.u2ug.org
Sent: Mon, Dec 5, 2011 12:49 pm
Subject: Re: [U2] End of Month date routine
ODAY = DATE()
OM = TODAY - TODAYDD + 32
OM = EOM - EOMDD
To: u2-users@listserver.u2ug.org
From: wjhon...@aol.com
Date: Mon
wjhon...@aol.com
To: u2-users u2-users@listserver.u2ug.org
Sent: Mon, Dec 5, 2011 2:15 pm
Subject: Re: [U2] End of Month date routine
arco, this is absolutely brilliant.
nd I reserve the use of the word brilliant, for code that truly transcends
ormal space-time
'm not certain that the use of DD
...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wols Lists
Sent: Monday, December 05, 2011 3:05 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] End of Month date routine
On 05/12/11 19:03, Wjhonson wrote:
Does someone have a routine that, no matter what day you
,
Wol
George
-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wols Lists
Sent: Monday, December 05, 2011 3:05 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] End of Month date routine
On 05/12/11 19:03, Wjhonson
Dave Laansma took a more generic approach which does not require
knowledge of the date format - hence I thought it preferable.
My style would move the addition and subtraction around as below
I assumed one would want the last day of the month for any called date
otherwise uncomment line 2
2:15 pm
Subject: Re: [U2] End of Month date routine
arco, this is absolutely brilliant.
nd I reserve the use of the word brilliant, for code that truly transcends
ormal space-time
'm not certain that the use of DD is vendor independent, but it could be
made
o, by merely using OCONV
Okay you win the prize for the longest method ;)
-Original Message-
From: Rick Nuckolls r...@lynden.com
To: U2 Users List u2-users@listserver.u2ug.org
Sent: Mon, Dec 5, 2011 5:00 pm
Subject: Re: [U2] End of Month date routine
Just for laughs, the following works with only
60 matches
Mail list logo