[comp.sys.handhelds] Day of week

ggill@fs0.ee.ubc.ca (GILL GURINDER) (04/09/90)

In article <109rhelps@yoda.byu.edu> rhelps@yoda.byu.edu writes:
>Jim Cloos uses a Day of Week (DOW) routine in his program.  I have some
>improvements to offer.  When I first got my 48SX and saw all the time and date
>functions I was a little surprised that a DOW function was not included (I




How about this for DOW?
 
/<< 0 TSTR 1 3 SUB />>
 
Which takes a real number from stack level 1 and returns the d-o-w in
a 3 character string ?
----------------------
George Lin
Engineering, UBC

davidbro@microsoft.UUCP (Dave BROWN) (04/10/90)

In article <109rhelps@yoda.byu.edu> rhelps@yoda.byu.edu writes:
>Jim Cloos uses a Day of Week (DOW) routine in his program.  I have some
>improvements to offer.  When I first got my 48SX and saw all the time and date
>functions I was a little surprised that a DOW function was not included (I
>know, I know "Life is short and ROM is full"), so I wrote one as my first
>attempt at a 48 program.  Looking at Jim's 28S adaptation I improved mine a bit
>and here it is.

Don't know about speed, but there's already a DOW routine built into the
calculator, the TSTR function wouldn't be able to do what it does...  So why
don't we use it:

<< 12.00 TSTR 1 3 SUB >>

If you want the number too:

<< 12.00 TSTR 1 3 SUB
   DUP {"SUN" "MON" "TUE" "WED" "THU" "FRI" "SAT"} POS 1 - >>

Date is in DD.MMYYYY format.

dave
-- 
Dave Brown                                       ...!uunet!microsoft!davidbro
...ni ssendriew eht tel eW
"the night doesn't like it...
 looks just like your face in the moon to me"

cloos@batcomputer.tn.cornell.edu (James H. Cloos Jr.) (04/10/90)

A very good responce, I think, to my posting.  Just the way I like it, many
suggestions and, in the end, better code!

I am now using Eric Postpischil's code for the DST changing, and replaced
my DOW code with that posted by Richard Helps.  I also had a program I
called DOW2 that was the exact code George Lin posted.  To go with that are:
FMTDT \<< TSTR 5 12 SUB \>> @ ForMaT DaTe @
FMTTM \<< TSTR 14 22 SUB \>> @ ForMaT TiMe @
TIMSTMP \<< DATE TIME TSTR PR1 DROP \>> @ TIMe STaMP @

Hope you enjoy.  Also, if anyone else finds ways to improve anything that I
post please post them, or at the very least mail them to me!!  Danke.

-JimC
--
James H. Cloos, Jr.          "Entropy isn't what it used to be."
Cloos@CrnlThry.BITNET            --c/o Fortune @ batcomputer.UUCP
Cloos@TCGould.TN.Cornell.EDU	 #include <std_disclaimers.h>
<world>!cornell!batcomputer!cloos	PersonalZipCode: 14048-0772

P.S.	I was recently informed of a type in my .signature file. It is
	now corrected.  The above is correct.