Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 3 123 LastLast
Results 1 to 15 of 37
  1. #1
    New Coder
    Join Date
    Nov 2010
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts

    changes month and date

    Hello, and thanks for a great forum

    I have downloaded a script called Display time of last visit.

    Since I live in Norway, so the date is on the wrong line. It's November 18, but I want the date to be before the month if ya know what I mean. Is there anyone out there who can be so kind and help me change the script so that it is correct? I've tried, but .....

    this is what it says now:

    Thursday, November 18, 2010 09:59:28 AM I want it to be (is it is possibe to remove AM ?)
    Thursday, 18, November 2010 09:59:28 AM



    Sincerely, from Norway

    Jon
    isprinsessa.com

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,103
    Thanks
    80
    Thanked 4,554 Times in 4,518 Posts
    Try using toLocaleDateString() instead of just toString().

    If that's still not in the format you prefer, then you will need to create the string "in pieces" with coding.

    If you don't understand what I wrote, show your existing code.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    New Coder
    Join Date
    Nov 2010
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hello, and thanks for a quick answer

    I tried and replace ToString () with ToLocaleDateString (), but it did nothing .... I got the same order :-(... can you be so kind and help me?

    ( I have no idea on script :-)




    Sincerely from Norway

    Jon
    isprinsessa.com



    ps: how can I upload the script file? ( can I give the file on some mail?)
    Last edited by kijons; 11-19-2010 at 07:52 PM.

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,243
    Thanks
    203
    Thanked 2,555 Times in 2,533 Posts
    We cannot help you unless you show your relevant code, that is the code which produces the date output.

    Or are you refering to the script at
    http://www.javascriptkit.com/script/...astvisit.shtml

    If so just change the line

    var dispDate = dy + ", " + mn + " " + dd + ", " + yy + " " + hh + ":" + mins + ":" + secs + " " + ampm

    to:-

    var dispDate = dy + ", " + dd + " " + mn + ", " + yy + " " + hh + ":" + mins + ":" + secs;

    I would have thought that was sufficiently obvious for you to work out how to to make that alteration yourself.

    Note that if you remove AM/PM then 2000 hours will show as 0800. So you should delete these lines:-

    var ampm = "AM";
    if (hh >= 12) {ampm = "PM"}
    if (hh >12){hh = hh - 12};
    if (hh == 0) {hh = 12}

    Or of course replace AM/PM with whatever the Norwegian abbreviations are.
    Last edited by Philip M; 11-19-2010 at 08:13 PM.

  • #5
    New Coder
    Join Date
    Nov 2010
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hello

    Yeessss

    It is this code yes

    Jon


    ps: The clock shows 8:15 (In Norway, are this morning, but the time no is 20:15 that evening)
    Last edited by kijons; 11-19-2010 at 08:17 PM.

  • #6
    New Coder
    Join Date
    Nov 2010
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Last visit

    Hello


    Yeessss I get the ringt date now, but the time showing wrong in Norway....se the message before

    I removed the line: if (hh < 10) {hh = "0" + hh}; but the time is stil the same

    sorry people .... but I'm compleaty blanks on this ,,,,, you are very patient


    Jon
    Norway
    Last edited by kijons; 11-19-2010 at 08:47 PM.

  • #7
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,243
    Thanks
    203
    Thanked 2,555 Times in 2,533 Posts
    See Post#4.

    I removed the line: if (hh < 10) {hh = "0" + hh}; but the time is stil the same
    That line simply adds a leading zero to hours under 10.
    Last edited by Philip M; 11-19-2010 at 08:34 PM.

  • #8
    New Coder
    Join Date
    Nov 2010
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts
    hello

    it is possible to put in the text clock before the hour?

    Jon

    ps: We have not something called AM or PM, we have last 24 hours clock system
    Last edited by kijons; 11-19-2010 at 09:01 PM.

  • #9
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,103
    Thanks
    80
    Thanked 4,554 Times in 4,518 Posts
    If you are still getting the wrong time, *SHOW YOUR CODE* that you are using *NOW*.

    Yes, of course you can add "clock". Or anything you want.
    Code:
    var dispDate = "clock " + dy + ", " + dd + " " + mn + ", " + yy + " " + hh + ":" + mins + ":" + secs;
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #10
    New Coder
    Join Date
    Nov 2010
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts
    <br />
    <div style="text-align: center;"><script type = "text/javascript">

    /***********************************************
    * Display time of last visit script- by JavaScriptKit.com
    * This notice MUST stay intact for use
    * Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and more
    ***********************************************/

    var days = 730; // days until cookie expires = 2 years.
    var lastvisit=new Object();
    var firstvisitmsg="Dette er ditt første besøk på denne siden. Velkommen!";
    lastvisit.subsequentvisitmsg="Velkommen tilbake besøkende!<br><br>Ditt siste besøk på vår side var <b>[displaydate]</b>";

    lastvisit.getCookie=function(Name){
    var re=new RegExp(Name+"=[^;]+", "i");
    if (document.cookie.match(re))
    return document.cookie.match(re)[0].split("=")[1];
    return'';
    }

    lastvisit.setCookie=function(name, value, days){
    var expireDate = new Date();

    var expstring=expireDate.setDate(expireDate.getDate()+parseInt(days));
    document.cookie = name+"="+value+"; expires="+expireDate.toGMTString()+"; path=/";
    }

    lastvisit.showmessage = function() {
    var wh = new Date();
    if (lastvisit.getCookie("visitc") == "") {
    lastvisit.setCookie("visitc", wh, days);
    document.write(firstvisitmsg);
    }

    else {
    var lv = lastvisit.getCookie("visitc");
    var lvp = Date.parse(lv);
    var now = new Date();
    now.setTime(lvp);
    var day = new Array("Sømdag", "Mandag", "Tirsdag", "onsdag", "Torsdag", "Fredag", "Lørdag");
    var month = new Array ("Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember");
    var dd = now.getDate();
    var dy = now.getDay();
    dy = day[dy];
    var mn = now.getMonth();
    mn = month[mn];
    yy = now.getFullYear();
    var hh = now.getHours();
    var ampm = "AM";
    if (hh >= 12) {ampm = "PM"}
    if (hh >12){hh = hh - 12};
    if (hh == 0) {hh = 12}
    if (hh < 10) {hh = "0" + hh};
    var mins = now.getMinutes();
    if (mins < 10) {mins = "0"+ mins}
    var secs = now.getSeconds();
    if (secs < 10) {secs = "0" + secs}
    var dispDate = dy + ", " + dd + " " + mn + ", " + yy + " " + hh + ":" + mins + ":" + secs;
    document.write(lastvisit.subsequentvisitmsg.replace("[displaydate]", dispDate))
    }

    lastvisit.setCookie("visitc", wh, days);

    }

    lastvisit.showmessage();

    </script></div>

  • #11
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,103
    Thanks
    80
    Thanked 4,554 Times in 4,518 Posts
    You did *NOT* delete the lines Philip told you to!!! (in post #4)

    You need to REMOVE (delete, take out, throw away) these lines:
    Code:
    var ampm = "AM";
    if (hh >= 12) {ampm = "PM"}
    if (hh >12){hh = hh - 12};
    if (hh == 0) {hh = 12}
    And then, optionally, you can add the clock as I showed.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #12
    New Coder
    Join Date
    Nov 2010
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hello

    I deleted just the line if (secs < 10) {secs = "0" + secs}...but I will deleted all


    and the text clock:

    var dispDate = "clock " + dy + ", " + dd + " " + mn + ", " + yy + " " + hh + ":" + mins + ":" + secs;


    I try to move clock before the hh, but someting is wrong..

    Jon

  • #13
    New Coder
    Join Date
    Nov 2010
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts
    yeeeeehhhhh


    thanks....now I have just the text clock again

    Jon
    Norway

  • #14
    New Coder
    Join Date
    Nov 2010
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hello

    I made it to move the clock

    I wil say many thanks to all help

    From Norway

    Jon
    isprinsessa.com

  • #15
    New Coder
    Join Date
    Nov 2010
    Posts
    23
    Thanks
    1
    Thanked 0 Times in 0 Posts

    last visit

    Hello again


    This script .... it's just that I get to see it on my machine ????... We are sitting on multiple PCs in the house, but they can not see the new schript ... What is it .. .. can it be that it records Ip adressse ?..... everyone should just watch it


    From Norway

    Jon
    isprinsessa.com
    Last edited by kijons; 11-19-2010 at 10:37 PM.


  •  
    Page 1 of 3 123 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •