Weekday function returns wrong day

make

Member
Hi,

i want to use the Weekday function. I made a test with the follwing code. But the result isnt correct.

DEFINE VARIABLE daylist AS CHARACTER
FORMAT "x(10)"
INITIAL "Sunday, Monday, Thusday, Wednesday, Thursday, Friday, Saturday".
DEFINE VARIABLE dayname AS CHARACTER
LABEL "Weekday".
Define var daynum as int.
daynum = WEEKDAY(03/24/68). dayname = ENTRY(daynum,daylist).
DISPLAY dayname format "x(10)".

The date i use to test is a Sunday. But Progress tells me it is a Saturday, where is my mistake ???

Thanks foor your help.

Make
 

Crittar

Member
Make,

I just ran your code on my system and it worked fine, gave me the answer "Sunday".

Are you sure the code you have published here is exactly what you are running?
 

bendaluz2

Member
Start Date

I presume it is 03/24/1968 you are going for here, not 03/24/2068. But, depending on the start point for the progress calendar, you may get different results.

Use the -yy parameter on progress start up to correct the problem.

Here is an extract from the -yy parameter entry in the online manual
<pre>
YEAR RESULT
-yy (in DATE Format) YEAR FUNCTION

1900 50-99 1950-1999
00-49 1900-1949

1980 80-99 1980-1999
00-79 2000-2079

1850 50-99 1850-1899
00-49 1900-1949
</pre>
Obviously, the date falls on a different day in the two centuries, which explains the two results obtained.
My advice is always use 4 figure dates, then you dont have to worry about such things ( thought we'd all have learnt this lesson after the y2k pallava)
 

make

Member
Thanks ! Crittar and bendaluz2

The solution is very simple : The easiest things are very often the Heaviest! ;-)
When i use 03/24/68 Progress takes the Year 2068.
When i use 03/24/1968 then the correct values comes back.

Greets
Make
 
Top