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.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post New person here , Need help with HTML Date, Time Format!!

    Hello Everyone I have a game server and the clock is messed up so i decided to get another one that uses Server/PC time as the sites time.

    The issue im having is its Displayed like this Saterday,June 28,2014 And i need it to be like this 6/28/2014 Any clue what i can do?

    Html page code is below :
    **************************************************************************************************** *********************

    Code:
    <!DOCTYPE html>
    <html>
    <head>
      <meta http-equiv="content-type"
     content="text/html;charset=utf-8">
      <script class="jsbin" src="ajax/libs/jquery/1/jquery.min.js"></script>
      <meta charset="utf-8">
      <title>Clock</title>
    <!--[if IE]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]-->
      <style>
    article, aside, figure, footer, header, hgroup, menu, nav, section { display: block; }
    .jqclock { float:left; text-align:center; border: 0px solid; background: ; padding: 10px; margin:20px; }
    .clockdate { color: Orange; margin-bottom: 10px; font-size: 18px; display: block;}
    .clocktime { border: 0px inset ; background: ; padding: 5px; font-size: 14px; font-family: "Courier"; color: Orange; margin: 2px; display: block; }
    button { margin: 20px; }
      </style>
      <style id="jsbin-css">
      </style>
    </head>
    <body>
    <h1></h1>
    <div style="clear: both;">
    <h2></h2>
    <div id="clock1">This div will be turned into a dynamic
    clock</div>
    <script>
    /* Sets time in clock div and calls itself every second */
    /**
    * Clock plugin
    * Copyright (c) 2010 John R D'Orazio (donjohn.fmmi@gmail.com)
    * Dual licensed under the MIT and GPL licenses:
    * The MIT License (MIT) | Open Source Initiative
    * The GNU General Public License v3.0 - GNU Project - Free Software Foundation
    * * Turns a jQuery dom element into a dynamic clock
    * * @timestamp defaults to clients current time
    * $("#mydiv").clock();
    * >> will turn div into clock using client computer's current time
    * @timestamp server-side example:
    * Say we have a hidden input with id='timestmp' the value of which is determined server-side with server's current time
    * $("#mydiv").clock({"timestamp":$("#timestmp").val()});
    * >> will turn div into clock passing in server's current time as retrieved from hidden input
    * * @format defaults to 12 hour format,
    * or if langSet is indicated defaults to most appropriate format for that langSet
    * $("#mydiv").clock(); >> will have 12 hour format
    * $("#mydiv").clock({"langSet":"it"}); >> will have 24 hour format
    * $("#mydiv").clock({"langSet":"en"}); >> will have 12 hour format * $("#mydiv").clock({"langSet":"en","format":"24"}); >> will have military style 24 hour format
    * $("#mydiv").clock({"calendar":true}); >> will include the date with the time, and will update the date at midnight
    * */
    (function($, undefined) {
    $.clock = { version: "1.0.0", locale: {} }
    $.fn.clock = function(options) {
    var locale = {
    "it":{
    "weekdays":["Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"],
    "months":["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"]
    },
    "en":{
    "weekdays":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],
    "months":["January","February","March","April","May","June","July","August","September","October","November","December"]
    },
    "es":{
    "weekdays":["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"],
    "months":["Enero", "Febrero", "Marzo", "Abril", "May", "junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"]
    },
    "de":{
    "weekdays":["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"],
    "months":["Januar", "Februar", "März", "April", "könnte", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"]
    },
    "fr":{
    "weekdays":["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"],
    "months":["Janvier", "Février", "Mars", "Avril", "May", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"]
    },
    "ru":{
    "weekdays":["???????????", "???????????", "???????", "?????", "???????", "???????", "???????"],
    "months":["??????", "???????", "????", "??????", "???", "????", "????", "??????", "????????", "???????", "??????", "???????"]
    }
    }
    return this.each(function(){
    $.extend(locale,$.clock.locale);
    options = options || {}; if(options=="destroy"){ $(this).updateClock($(this),"destroy"); }
    if(options.timestamp!=undefined){
    mytimestamp = options.timestamp;
    mytimestamp = new Date(options.timestamp);
    }
    else{ options.timestamp = new Date();
    mytimestamp = options.timestamp;
    options.timestamp = options.timestamp.getTime();
    }
    options.langSet = options.langSet || "en";
    options.format = options.format || ((options.langSet!="en") ? "24" : "12");
    options.calendar = options.calendar || "true";
    options.timestamp += 1000;
    var addleadingzero = function(i){
    if (i<10){i="0" + i;}
    return i; },
    h=mytimestamp.getHours(),
    m=mytimestamp.getMinutes(),
    s=mytimestamp.getSeconds(),
    dy=mytimestamp.getDay(),
    dt=mytimestamp.getDate(),
    mo=mytimestamp.getMonth(),
    y=mytimestamp.getFullYear(),
    ap="",
    calend="";
    if(options.format=="12"){
    ap=" AM";
    if (h > 11) { ap = " PM"; }
    if (h > 12) { h = h - 12; }
    if (h == 0) { h = 12; }
    }
    // add a zero in front of numbers 0-9
    h=addleadingzero(h);
    m=addleadingzero(m);
    s=addleadingzero(s);
    if(options.calendar!="false") {
    if (options.langSet=="en") {
    calend = "<span class='clockdate'>"+locale[options.langSet].weekdays[dy]+', '+locale[options.langSet].months[mo]+' '+dt+', '+y+"</span>";
    }
    else {
    calend = "<span class='clockdate'>"+locale[options.langSet].weekdays[dy]+', '+dt+' '+locale[options.langSet].months[mo]+' '+y+"</span>";
    }
    }
    if ( !$(this).hasClass("jqclock") ) {
    $(this).addClass("jqclock");
    }
    $(this).html(calend+"<span class='clocktime'>"+h+":"+m+":"+s+ap+"</span>");
    $(this).updateClock($(this),{"calendar":options.calendar,"timestamp":options.timestamp,"langSet":options.langSet,"format":options.format});
    });
    }
    t = new Array();
    $.fn.updateClock = function(el,myoptions) {
    var el_id = $(el).attr("id");
    if(myoptions=="destroy"){ clearTimeout(t[el_id]); }
    else { t[el_id] = setTimeout(function() {$(el).clock(myoptions)}, 1000); }
    }
    return this;
    })(jQuery);
    /* Now apply on document ready to jsbin page */
    $(document).ready(function(){
    $.clock.locale = {"pt":{"weekdays":["Domingo","Segunda-feira", "Terça-feira","Quarta-feira","Quinta-feira","Sexta-feira", "Sábado"],"months":["Janeiro","Fevereiro","Março","Abril", "Maio","Junho","Julho","Agosto","Setembro","October","Novembro", "Dezembro"] } };
    $("#clock1").clock();
    $("#clock2").clock({"langSet":"it"});
    $("#clock3").clock({"langSet":"pt"});
    $("#clock4").clock({"format":"24","calendar":"false"});
    customtimestamp = new Date();
    customtimestamp = customtimestamp.getTime();
    customtimestamp = customtimestamp+1123200000+10800000+14000;
    $("#clock5").clock({"timestamp":customtimestamp});
    $("#destroyclock1").click(function(){ $("#clock1").clock("destroy") });
    $("#destroyclock2").click(function(){ $("#clock2").clock("destroy") });
    $("#destroyclock3").click(function(){ $("#clock3").clock("destroy") });
    $("#destroyclock4").click(function(){ $("#clock4").clock("destroy") });
    $("#destroyclock5").click(function(){ $("#clock5").clock("destroy") });
    });
    </script>
    <script src="js/render/edit.js"></script>
    <script src="js/vendor/eventsource3445.js?3.12.4"></script>
    <script src="js/spike3445.js?3.12.4"></script>
    <script>
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-1656750-34']);
    _gaq.push(['_trackPageview']);
    (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
    })();
    </script></div>
    </body>
    </html>
    If you can help me please let me know!!
    Attached Thumbnails Attached Thumbnails New person here , Need help with HTML Date, Time Format!!-clock.jpg  
    Last edited by VIPStephan; 06-30-2014 at 08:58 AM. Reason: added code BB tags

  • #2
    New Coder
    Join Date
    Nov 2010
    Posts
    81
    Thanks
    13
    Thanked 3 Times in 3 Posts


  •  

    Posting Permissions

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