Usual way:
START=$(date +%s.%N)
sleep 5
END=$(date +%s.%N)
DIFF=$(echo "$END - $START" | bc)
# print seconds
echo $DIFF
Use SECONDS what is a bash special variable that returns the seconds since set:
SECONDS=0
sleep 5
DURATION_IN_SECONDS=$SECONDS
# Now $DURATION_IN_SECONDS is the number of seconds
echo $DURATION_IN_SECONDS