This sample shows the usage of DataFormWebPart to switch the image each full hour.
There is a Image Library with a field "DayTime" with values from 00 to 23.
In the XSL Part of the DataFormWebPart there is a select clause like this:
<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[substring(@DayTime,1,2)=substring(ddwrt:TodayIso(), 12, 2)]"/>