Moving 'date' command out of loop