You should have more abstraction. Date handling code is rarely clear. Embedding it presentation code is rarely advisable. Calculate day of week in one function. Calculate time of day in another function then generate position based on these functions.