Dairy cow behavior is affected by external and endogenous factors, including time of year, barn microclimate, time of day and housing. However, little is known about the combined effects of these factors. Data were collected on eight farms in Northern Italy during summer, winter and a temperate season. The temperature-humidity index (THI) was recorded using environmental sensors, whereas cow behavior was monitored using leg accelerometers and cameras. Period, time of day and their interaction all significantly affected lying, standing and feeding behavior. However, although THI had a significant negative effect on lying and a positive effect on standing during daytime (all p < 0.001), during nighttime, it only had a significant negative effect on lying duration and mean lying bout duration (p < 0.001 for both). There was also significant variation between farms in all behavioral parameters, as well as interactions with period and time of day. For instance, farm differences in lying duration were more pronounced during daytime than during nighttime. These findings show how housing can interact with other factors, such as period of the year and time of day, and illustrate the influence of barn structure and farm management on cow behavior and, consequently, their welfare.