Here, it explains the logic of what you are trying to do:
Page loading time script[
^]
Something like:
Copy and paste the code below after
<head>
in a
script
tag
var d = new Date();
var starttime = d.getTime();
Now find and paste this code before
</body>
in a
script
tag
var d2 = new Date();
var endtime = d2.getTime();
var totaltime = (endtime - starttime)/1000;
var result = Math.round(totaltime*100)/100;
document.getElementById("loadtime").innerHTML = "Page loading time: "+ result +" seconds";