Day of the Week.....Ahhh GAIN!!!
![hmlittle59](https://forums.parallax.com/uploads/userpics/199/nCR6ABWFQF1HY.jpg)
OK, yes I've ask this before but got a routine that I could not get to work...If someone wants a challenge then fix this routine or tell me it works great like it suppose to, and then dummy it down for me....if it can be any more........thanks
I want to learn how to do this...
thanks again
PS:I have one more I want to get and get working.....(Day Light Savings Time)...Yea Haa.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'M STILL LEARNING SO MUCH...BUT STILL KNOW SO LITTLE!!!
hmlittle59
IF month < 3 THEN month = month + 12 year = year - 1 ENDIF Day = (Date+2*month+(3*(month +1)/5)+year+(year/4)-(year/100)+(year/400) + 1) // 7
I want to learn how to do this...
thanks again
PS:I have one more I want to get and get working.....(Day Light Savings Time)...Yea Haa.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'M STILL LEARNING SO MUCH...BUT STILL KNOW SO LITTLE!!!
hmlittle59
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'M STILL LEARNING SO MUCH...BUT STILL KNOW SO LITTLE!!!
hmlittle59
Be this (or something like it):
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
any help
thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'M STILL LEARNING SO MUCH...BUT STILL KNOW SO LITTLE!!!
hmlittle59
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
thanks again
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'M STILL LEARNING SO MUCH...BUT STILL KNOW SO LITTLE!!!
hmlittle59
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)
· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Pj Allen I have been trying your code and Sunday does not want to print out to the screen(Monday Prints). February 7,21,2010 makes the program restart...
I'm using the BS2e...If that helps
Thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'M STILL LEARNING SO MUCH...BUT STILL KNOW SO LITTLE!!!
hmlittle59
It's a little snag with the LOOKUP and total.· I got that turned around.
Exactly how are you participating in the process, is it strictly as a consumer?
Looking at when Day Light Saving Time starts/Ends, I might be able to work up a routine that will detect the 2nd Second weekend of the Month using(GOSUB) to some of your code for Day Of The Week. I will have to save any flags in the DS1302 RAM/EEPROM RAM, no space left. My Pseudo Code looks like it will work.
thanks
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'M STILL LEARNING SO MUCH...BUT STILL KNOW SO LITTLE!!!
hmlittle59
day add
1 Mon +14
0 Sun +15
6 Sat +16
5 Fri +17
4 Thu +18
3 Wed +19
2 Tue +20
And to calculate on a Stamp...
For a more general formula, for some event that will happen on the nDay'th wDay of the month, e.g. 3rd Monday
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Post Edited (Tracy Allen) : 1/2/2010 6:50:25 PM GMT
Did the rest of the Pseudo Code for Day Light Savings Time and it looks like it will work...we'll see..
Google says DLST is 3rd wk of March and 1st wk of Nov. My logic is to find the 1st day of March, get its DAY, then if its not SUNDAY then ADD 8, after that start counting up while GOSUBing to Day Of Week check til I reach the next SUNDAY. That should be the 2nd SUNDAY of the Month......LET me know if this makes ANY since.....My brain says yes!!!
.Wife says Christmas decoration must come down now!!!...Got to go
thanks alle
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'M STILL LEARNING SO MUCH...BUT STILL KNOW SO LITTLE!!!
hmlittle59
In the calculated version, if you know the day of week (=dow) on the first day of the month, then
springForward2Savings = 7 - dow // 7 +8
So March 1st, 2010 is a Monday, dow=1, so springForward2Savings is the 14th. (7 - 1 // 7 + 8 = 6//7 + 8 = 6 +8 = 14)
(I made a off-by-one correction to the formula in my previous post)
The observance of summer time and the specific dates is highly varied around the world.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
While taking down Christmas Decorations, I realize that on my last post I stated that I would just ADD 8 to the 1st of the month if it did not equal SUNDAY but that would be one(1) day to much...it should be 7. That way it would only take it out 1 week and not skip a day with 8.
OOPs!!!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'M STILL LEARNING SO MUCH...BUT STILL KNOW SO LITTLE!!!
hmlittle59
Just came in and started typing before I noticed your POST. Your correct, that logic should work even better...I don't always see these simple things...Glad I posted the thought.
Thanks again.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'M STILL LEARNING SO MUCH...BUT STILL KNOW SO LITTLE!!!
hmlittle59
This is the second attempt, I tried to reply earlier and got a server error...So this is 2 bummed out hours later...
Any way, I tried to implement your code and the Calender Dates does not always come out correct. I'm using part of the Parallax DS1302 Demo code with my own. I use Button Command with switches to change the time up/down and it works OK. I go from BCD format(DS1302) to DEC format(Serial LCD Parallax) to make changes to the time on the screen. Then I convert it back to BCD to save in the DS1302. All this works find. Now taking the (mm/dd/yy) variables and running them through your code, I'm not always getting the correct DOW. Also SATURDAY does not spell out(=?S), I'm using WORD/NIB variable and I've tried going through the BCD to BIN routine, but to no avail. I only want to get the value (1 - 7) and use it in the Demo routine that I'm already using to get the DOW. Again the two formats that I'm using is BCD & DEC.
Let me know if you have any thoughts on what I'm missing.
PS: Hope I don't get a server error this time...here goes
Howard
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'M STILL LEARNING SO MUCH...BUT STILL KNOW SO LITTLE!!!
hmlittle59
DEBUG CR, DEC2 mm, DEC2 dd, DEC2 yy, TAB, DEC JD, TAB, DEC dow
Right after dow is computed. I threw JD in there too, assuming that is still part of the computation. My guess is that there is some variable conflict somewhere. But I'd be better equipped to comment if I could see values that actually fail. Also, it might help if you attach your code.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
24hr bug got me...I will try and focus if I can to get the values so this can be figured out...Thanks
Howard
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'M STILL LEARNING SO MUCH...BUT STILL KNOW SO LITTLE!!!
hmlittle59
Think I got it working, put in a lot of Date(s) and they all seem to come out correct. The conversion from DS1302(BCD) to Parallax LCD Screen(DEC) value is what I needed to work with(insert) into your routine to get it working. The scrambled day(SATURDAY) came from the two(2) different DOW lookup tables starting point. Yours is from zero(0) and the DEMO program is from one(1). I looked at the table twice but didn't think it would affect the calculation. After you said to print out the values, I did and that's when I realized what was happening. Thanks...Now it's on to trying to get the "DAY LIGHT SAVING" routine to work.
Thanks Again...I'll Post it when done or the next bump in the road.
Howard
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'M STILL LEARNING SO MUCH...BUT STILL KNOW SO LITTLE!!!
hmlittle59
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com