Are you sure your database can't help you with that? I prefer letting the database doing that kind of stuff for me (because I am extremely lazy and it might even be faster, who knows..). And at least MySQL has some really neat date/time-convertion-functions. I'm pretty sure that commercial SQL-DBs have these kind of functions, too..