Is my algorithm bad here?

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.