move day of week function code to the only place it is used