How can I see how long students have spent on their homework?

You can view how long a student has spent on their homework from the Hand-in page in the Time spent column.