You have to catch stdin and stdout. For this, and based on the solution in Is there a way to redirect time output to file in Linux, I would say do:
{ time command ; } 2>&1
^^^^
redirect stderr to stdin
So you for example do:
$ var=$({ time echo 1 ; } 2>&1 )
$ echo "$var"
1
real 0m0.000s
user 0m0.000s
sys 0m0.000s