How to batch rename files via Terminal using the file's date as filename?
for f in *.*; do 
    echo mv "$f" "$(stat -f '%Sm' -t '%Y-%m-%d %H.%M.%S' "$f").${f##*.}"
done


Or as a one-liner:

for f in *.*; do echo mv "$f" "$(stat -f '%Sm' -t '%Y-%m-%d %H.%M.%S' "$f").${f##*.}"; done


In either case, remove the echo command after testing.

The ${f##*.} portion of the command get the extension of $f so you can use the glob *.* vs. using an extension in the for f in, i.e. for f in *.* vs. for f in *.jpg