Fixed use of date() function