i want a design and develop a web page which will show the current time on the basis of the

request. eg if the request of the page is come from dubai then the server automaticaly finds

the current time of dubai and writes that time on the page. similarly if the request comes

from india then the server aoutomatically finds the curent time of india and write that time

on the page before sending that page to the client????

1; Set index.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>

<body>

<?php
session_start();
echo $timezone = $_SESSION['timezone'];

?>
</body>
</html>
<script type="text/javascript">
    $(document).ready(function() {
        if("<?php echo $timezone; ?>".length==0){
            var visitortime = new Date();
            var visitortimezone = "GMT " + -visitortime.getTimezoneOffset()/60;
            $.ajax({
                type: "GET",
                url: "http://www.yoursite.php/time.php",
                data: 'timezone='+ visitortimezone,
                success: function(){

                    location.reload();
                }
            });
        }
    });
</script>

2; Set time.php

<?php
    session_start();
    $_SESSION['timezone'] = $_GET['timezone'];
?>
commented: Don't copy somebody else's code and supply it as your own. A link is sufficient -3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.