Post Reply 
DAYOFWEEK command
08-22-2015, 05:24 PM
Post: #1
DAYOFWEEK command
Hello,
I am very courious to know the reason why the DAYOFWEEK command returns 1 for monday instead of 2.

I have programmed for years and it has always been like that. Being European i like it but I'd like to understand if there was a decision on this.

Maybe the answer is very simple: Cirille coded it :+)

Bye

Giancarlo
Find all posts by this user
Quote this message in a reply
08-22-2015, 08:05 PM
Post: #2
RE: DAYOFWEEK command
I had a short look at wikipedia. (de.wikipdia.org: https://de.wikipedia.org/wiki/Wochentag#...Wochentage)
There i found this:
"Seit 1978 ist auf Beschluss der UNO der Montag international der erste Tag der Woche"
"Since 1978, on the decision of the UN Monday is the first day of the week"
Find all posts by this user
Quote this message in a reply
08-22-2015, 09:31 PM
Post: #3
RE: DAYOFWEEK command
R'uh r'oh !!

2speed HP41CX,int2XMEM+ZEN, HPIL+DEVEL, HPIL+X/IO, I/R, 82143, 82163, 82162 -25,35,45,55,65,67,70,80
Find all posts by this user
Quote this message in a reply
08-22-2015, 10:07 PM
Post: #4
RE: DAYOFWEEK command
(08-22-2015 09:31 PM)TASP Wrote:  R'uh r'oh !!
? what does this mean ?
Find all posts by this user
Quote this message in a reply
08-22-2015, 10:49 PM
Post: #5
RE: DAYOFWEEK command
That is the sound Scooby Doo made when things went akimbo.

2speed HP41CX,int2XMEM+ZEN, HPIL+DEVEL, HPIL+X/IO, I/R, 82143, 82163, 82162 -25,35,45,55,65,67,70,80
Find all posts by this user
Quote this message in a reply
08-23-2015, 06:36 AM
Post: #6
RE: DAYOFWEEK command
Fear not, Giancarlo, Sunday retains its primacy in the seven day week.

The calendar was instituted by primitives who had a

https://soundcloud.com/fearofzero

or possibly just ignored its existence as best they could.

In the modern world, as personified by our best representatives in the UN, no such fear or ignorance prevails - so in their wisdom, knowing weekdays are counted modulo 7, they chose Sunday as day zero.

Sadly language takes some centuries to catch up with maths, so we won't be placing the winners at the next Olympics in zeroth position, but just hang around long enough...
Find all posts by this user
Quote this message in a reply
08-23-2015, 06:39 AM
Post: #7
RE: DAYOFWEEK command
(08-22-2015 10:49 PM)TASP Wrote:  That is the sound Scooby Doo made when things went akimbo.
what is the relationship to the DAYOFWEEK command ?
Find all posts by this user
Quote this message in a reply
08-23-2015, 06:45 AM
Post: #8
RE: DAYOFWEEK command
https://en.wikipedia.org/wiki/Determinat...f_the_week
Find all posts by this user
Quote this message in a reply
08-23-2015, 10:48 AM
Post: #9
RE: DAYOFWEEK command
Thanks for your reply.

I think i played too much with old calcs and i lost what happen in the meantime in the last few decades,

Ciao

Giancarlo
Find all posts by this user
Quote this message in a reply
08-26-2015, 03:10 AM
Post: #10
RE: DAYOFWEEK command
I don't know if this is of any help, but the second page of configuration settings for "Home" has a setting "Choose first day of week" at least in the HP Prime Virtual Calculator (2014-12-03, build 6975), which isn't documented in the corresponding help file as of 2014-11-07 (but it might be documented in newer versions, I don't know, as I can't install them).

The DAYOFWEEK command was added with the 2015-04-27, build 7820 firmware update. According to the help screen (http://hp-prime.de/de/id/61-firmware-update), it does not look as if it would be configurable, but you might give the above setting a try. (However, if it would turn out to be configurable, another function to read out the current configuration setting would be needed as well...)

Greetings,

Matthias


--
"Programs are poems for computers."
Find all posts by this user
Quote this message in a reply
08-26-2015, 05:56 AM
Post: #11
RE: DAYOFWEEK command
(08-26-2015 03:10 AM)matthiaspaul Wrote:  I don't know if this is of any help, but the second page of configuration settings for "Home" has a setting "Choose first day of week" at least in the HP Prime Virtual Calculator (2014-12-03, build 6975), which isn't documented in the corresponding help file as of 2014-11-07 (but it might be documented in newer versions, I don't know, as I can't install them).

The DAYOFWEEK command was added with the 2015-04-27, build 7820 firmware update. According to the help screen (http://hp-prime.de/de/id/61-firmware-update), it does not look as if it would be configurable, but you might give the above setting a try. (However, if it would turn out to be configurable, another function to read out the current configuration setting would be needed as well...)

The "Choose first day of week" Home Setting only effects the pop-up calendar that you get when you tap the upper right corner of the screen and then tap the time or date. It does not change the DAYOFWEEK output, which always returns 1 through 7 for Monday through Sunday, respectively.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
08-26-2015, 08:36 AM
Post: #12
RE: DAYOFWEEK command
Hello,
I think this is a wise decision. If the user was not aware of the different behaviour of a command (DAYOFWEEK) based on a 'flag' or setting this could lead to errors if not trapped by a conditional test.

I have the same feedback for the date commands (DDAYS,...) and the date formatting (DD/MM/YYY vs. MM/DD/YYYY).

I am very happy to have - back again - the date commands. I am still missing the BEEP comand along with it hardware.

Giancarlo
Find all posts by this user
Quote this message in a reply
08-26-2015, 10:43 AM (This post was last modified: 08-26-2015 10:45 AM by matthiaspaul.)
Post: #13
RE: DAYOFWEEK command
(08-26-2015 08:36 AM)Giancarlo Wrote:  I think this is a wise decision. If the user was not aware of the different behaviour of a command (DAYOFWEEK) based on a 'flag' or setting this could lead to errors if not trapped by a conditional test.
Exactly. This is what I meant by "needs another function to read the setting". Without it, configurability would cause unsolveable sideeffects in programs.

Like you, I think it is good as it is, except for that most day-of-week functions I have seen implemented in libraries or shells elsewhere return 1 = Sunday rather than 1 = Monday (or even 0 = Sunday), so the results may be unexpected to some. I have also seen two sets of functions being implemented to avoid this, like in DOW (for 1 = Sunday) and ISODOW (for 1 = Monday) etc., perhaps still an option for the Prime as well...

Quote:I am still missing the BEEP comand along with it hardware.
Yes, it would be nice to have, so that the calculator could give acoustic feedback on errors or touch screen gestures (only if mutable, of course) and be used as an alarm timer as well. Also, kids might have fun to implement some rudimentary music programs, like probably many of us did when we were young. IMO, by not providing an option to output sound (it doesn't need to be sophisticated), HP is missing a sales incentive. A beeper is a checklist item for some.

Greetings,

Matthias


--
"Programs are poems for computers."
Find all posts by this user
Quote this message in a reply
08-26-2015, 02:51 PM
Post: #14
RE: DAYOFWEEK command
(08-26-2015 10:43 AM)matthiaspaul Wrote:  Like you, I think it is good as it is, except for that most day-of-week functions I have seen implemented in libraries or shells elsewhere return 1 = Sunday rather than 1 = Monday (or even 0 = Sunday), so the results may be unexpected to some. I have also seen two sets of functions being implemented to avoid this, like in DOW (for 1 = Sunday) and ISODOW (for 1 = Monday) etc., perhaps still an option for the Prime as well...

Needless to say (but that never stopped me before), Prime's DAYOFWEEK output can be made to agree with HP's financial calculators which use 0 for Sunday (ISODOW) by simply appending "MOD 7" after the DAYOFWEEK. Example: DAYOFWEEK(1955.0821) MOD 7 returns 0, because 21 August 1955 was a Sunday.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
08-27-2015, 03:57 AM
Post: #15
RE: DAYOFWEEK command
(08-23-2015 06:39 AM)Thomas_Sch Wrote:  
(08-22-2015 10:49 PM)TASP Wrote:  That is the sound Scooby Doo made when things went akimbo.
what is the relationship to the DAYOFWEEK command ?

I was commenting on the UN angle. I was just really, totally and unexpectedly surprised by that.

2speed HP41CX,int2XMEM+ZEN, HPIL+DEVEL, HPIL+X/IO, I/R, 82143, 82163, 82162 -25,35,45,55,65,67,70,80
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)