Re: HP-41 Date to Week / Week to Date conversion Message #7 Posted by Geir Isene on 19 Feb 2006, 2:22 p.m., in response to message #2 by Karl Schneider
Quote:
What is "date in the normal format"? We use MM.DDYYYY in the US, but Europe uses DD.MMYYYY. The Time Module and the HP-41CX support both. (Flag 31 clear = MDY; Flag 31 set = DMY).
The program now supports both date conventions. Bear in mind that it does however show the first monday of the week when you enter the week number and execute "W-D". This is according to the ISO week number specification.
Quote:
Also, several examples would be helpful.
Enter (in DMY mode):
2,012006
XEQ'D-W
and you get:
1
Enter (in MDY mode):
11,2007
XEQ'W-D
and you get:
3,122007
Enter (in MDY mode):
11
XEQ'W-D
and you get:
3,132006
Quote:
I get -12 as the answer, running "D-W" for MM.DDYYYY = 12.182006. That doesn't seem correct, but the program was entered correctly.
Fixed:
001 *LBL "D-W"
002 ENTER
003 ENTER
004 XEQ 01
005 X<>Y
006 DDAYS
007 7
008 /
009 2,1
010 +
011 INT
012 RTN
013 *LBL "W-D"
014 ENTER
015 INT
016 X NE Y?
017 SF 05
018 2
019 -
020 7
021 *
022 FS?C 05
023 GTO 02
024 DATE
025 LBL 03
026 XEQ 01
027 X<>Y
028 DATE+
029 RTN
030 LBL 01
031 100
032 *
033 FRC
034 100
035 /
036 FC? 31
037 1,04
038 FS? 31
039 4,01
040 +
041 ENTER
042 DOW
043 8
044 -
045 CHS
046 DATE+
047 RTN
048 LBL 02
049 X<>Y
050 FRC
051 100
052 /
053 1,1
054 +
055 GTO 03
056 END
|