Browser's time script anyone?

by 10 replies
12
Anyone know of a script that will display the local date and time of my website visitor?

Not of my server, and visible in every browser please ;-)

I've looked in script directories, but at first glance I can only find scripts that'll display my server's time...
#main internet marketing discussion forum #browser #script #time
  • That can only be done with javascript as far as I know and only if it is turned on in the visitors browser. It depends on what it is you plan to use this for as to what script you would need.

    Do a search in google for javascript time display code.


    - T
  • Hi Terry!

    I did (see above).

    Here's what it's meant to be for (I'll reveal the secret ;-)
    --> When I surf and find a sales page ... (not that difficult with all the affiliates around ;-) ... what will entice me most to buy NOW? (instead of ... never!)

    If the seller connects with me totally!

    I have many more things I miss on today's sales pages but which I'm employing at mine, and knowing the visitors time is useful for three of these. I don't care about my time, I care about your time! :-)
  • There is not a 100% fool proof way of doing this because even if you test for javascript and do a work around if it is not enabled you cannot work around working javascript but local computer clock set incorrectly. You can get close but not close enough if it is critical. You could get the geographical location of the remote ip address and use that to get the time zone I suppose.

    Clive
    • [1] reply
    • Sounds like you know your stuff Clive! If local computer clock set incorrectly, doesn't matter. I was actually thinking of remote ip address concept, only I don't have a script for that/ cannot code that.

      Does anyone have a miniature "script" a la "date&time of ip address = ...."?

      Or however a script should look
  • Are you looking for server side code such as PHP or are you prepared to live with JavaScript and its limitations for this purpose?
  • I think for your purposes that server-side Geo Targeting is the best way to go. Determine your users IP address, get their location and then get the local time there.

    A few good articles to get you started:

    Geo-Targeting PHP Script | Eric Nagel

    Finding Your Visitors: The Geotargeting Manual for Dummies | Search Engine People | Toronto

    How To Easily Implement Custom GeoTargeting ยป DerekBeau.com

    And the MaxMind database is a free Geo Location database (they also have a paid one) that is often used to get the Geo Targeting information:

    MaxMind - GeoLite Country | Open Source IP Address to Country Database

    Hope this is of some help to you.

    Bill
    • [1] reply
    • Huh sorry Clive, haven't logged in earlier 'cause veeery busy preparing my first product launch on Clickbank... ;-)
      I personally "like" javascript (if you can "like" code), only problem I see is that visitors must have enabled it in their browser - and maany people are scared/don't enable it... :-(

      Yes Bill, this makes sense to me, thank you. So I guess I'll have to take a week off and research the links you kindly provided.
      Or, just by chance, have you done that already and use a certain script yourself which I could somehow "acquire"?
  • Hi there,

    Thanks for the links.

    I'm having trouble understanding how I can actually test Geo Targeting? I guess via proxy IP addresses, but I'm reading that they don't always work.

    Anyone have any reliable means of testing?

    Thanks
    • [1] reply
    • In response to my own question - I think manual testing is tricky and not a great use of time.

      Instead I plan to test via a spacer gif named differently for each country, then compare en mass any change in traffic volumes between my raw logs and the spacer count for the pages that I'm testing on.

      I'll put a full explanation on my site.

      Cheers
  • Hi there! I think this might work...try pasting it into notepad and saving it as an HTML file to test it out (I've marked the time and date codes with //Time and //Date):

    HTML Code:
    <body onLoad="clock()">
    <span id="pendule" style="position:absolute;left:50;top:50;"></span>
    <script language="javascript">
    //Time
    function clock() {
    if (!document.layers && !document.all) return;
    var digital = new Date();
    var hours = digital.getHours();
    var minutes = digital.getMinutes();
    var seconds = digital.getSeconds();
    var amOrPm = "AM";
    if (hours > 11) amOrPm = "PM";
    if (hours > 12) hours = hours - 12;
    if (hours == 0) hours = 12;
    if (minutes <= 9) minutes = "0" + minutes;
    if (seconds <= 9) seconds = "0" + seconds;
    dispTime = hours + ":" + minutes + ":" + seconds + " " + amOrPm;
    if (document.layers) {
    document.layers.pendule.document.write(dispTime);
    document.layers.pendule.document.close();
    }
    else
    if (document.all)
    pendule.innerHTML = dispTime;
    setTimeout("clock()", 1000);
    }
    //Date
    var now = new Date();
    var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
    var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
    var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
    function fourdigits(number) {
    return (number < 1000) ? number + 1900 : number;
    }
    today = days[now.getDay()] + ", " +
    months[now.getMonth()] + " " +
    date + ", " +
    (fourdigits(now.getYear())) ;
    document.write(today);
    </script>
    </body>

Next Topics on Trending Feed