Hi,

I copied this algorithm from someone else’s post. But for some reason I am getting **Monday** when it’s actually **Thursday** now (here in Sydney, Australia). Can any of you geniuses help me out here?

Any help will be appreciated.

Hi,

I copied this algorithm from someone else’s post. But for some reason I am getting **Monday** when it’s actually **Thursday** now (here in Sydney, Australia). Can any of you geniuses help me out here?

Any help will be appreciated.

I assume your just trying to get the current local day of the week. to do that its probably easiest to base it of dayofyear then just modulo 7. this will likely not give the right answer right off because you need to compensate for what day the year began on.

What are u trying to get? Today’s day?

Yes. I was trying to get today’s day.

Thank you so much !!

whats not working? or rather how is it not working?

Sorry, I’ve re-opened this question. The simpler solution above doesn’t give me the right day most of the time.

For example, today (Feb 6, 2018) is day 37. So, it gives me a result of **5** (37 - 1 / 7 = 5), which is *Friday* (or *Option 4*)

Oops. Yeah, I had the divide symbol instead of the modulus symbol.

Yeah, that’s clear to me now.

Thank you.

thats not a divide symbol its a modulus (%). a modulus gives the remainder of a division. so it would actually be 37-1 = 36, 36/7= 5, 7*5 = 35, 36-35=1 (36%7=1) on equal tuesday which is what it is on your side of the world. its a lot easier to explain on paper but just imagine doing long division a modulus does the division and only returns the remainder.

you may actually need to modify that though since it will only work for this year. next year it will need to subtract 2 since the year 2019 starts on a tuesday. thats one of the reason all computer clocks have a base date or at least they did once upon a time.