Display Running Time

Display Running Time in JavaScript

Details: Display Running Time

This tutorial will give you a basic understanding of how to create a running time using JavaScript and PHP. It is a simple and straight design that serves to give you the required knowledge on how to create the program.

JavaScript: Display Running Time

The PHP code included helps us in displaying our running time. To run this script, you need to create the text by opening your HTML code editor and copy and paste the below code. You can name this script “time.php”.

					<span id=tick2>			
    function show2(){
        if (!document.all&&!document.getElementById)
        thelement=document.getElementById? document.getElementById("tick2"): document.all.tick2
        var Digital=new Date()
        var hours=Digital.getHours()
        var minutes=Digital.getMinutes()
        var seconds=Digital.getSeconds()
        var dn="PM"
        if (hours<12)
        if (hours>12)
        if (hours==0)
        if (minutes<=9)
        if (seconds<=9)
        var ctime=hours+":"+minutes+":"+seconds+" "+dn
        $date = new DateTime();
        echo $date->format('l -- F j, Y');

Create a display page: Display Running Time

For the final page, we need to display our running time on a page for view. To create this page, copy and paste the code below after the tag in your HTML code editor and you can save page as “index.php”.

<title>Simple Running Time using PHP</title>
    <?php include ('time.php'); ?>

Result: Display Running Time

Display Running Time, javascript, free source code, runtime, free download, source code

We have successfully illustrated the tutorial with the above codes.

Don’t forget to share this post!

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Article