The % symbols need to be escaped in cron jobs.
Put a backslash in front of each one.
Late edit:
I'm not sure how I missed this before but you are using a bash syntax for creating a subshell to run your date
command in. Since cron is not bash, this won't work. It will work if you change your cron job to this:
0 20 * * * /data/code/scripts/foo.sh >/root/foo.`date +\%Y-\%m-\%d-\%T`.log 2>&1
Alternatively, you could do the output redirection from within the script or (if that's not appropriate) write a wrapper script that calls the above one and does the output redirection.