With OSX stat:
for file in *; do dir="$(stat -t %Y%m%d%H%M%S -f %Sm -- "$file")" mkdir -p "$dir" mv -- "$file" "$dir/$file" done
With GNU stat (i.e. on Linux or Cygwin):
for file in *; do dir="$(stat -c %Y -- "$file")" mkdir -p "$dir" mv -- "$file" "$dir/$file" done
This will move each file into a directory named with its mtime (as an epoch).
If you want finer grained control over how the directory looks, you can use GNU date to reformat it by changing the assignment line to something like this:
dir="$(date -d @"$(stat -c %Y -- "$file")" +%F)"
See man date for information about date format specifications that you can use. In this case, %F is:
%F full date; same as %Y-%m-%d