Skip to content

Instantly share code, notes, and snippets.

@lambda2
Created November 6, 2013 08:14
Show Gist options
  • Select an option

  • Save lambda2/7332601 to your computer and use it in GitHub Desktop.

Select an option

Save lambda2/7332601 to your computer and use it in GitHub Desktop.
Affiche l'heure courant ou truc dans le container avec l'id donnée en paramètre (ici, heure)
function getHeure(container, utc)
{
d = new Date()
if (utc)
{
t = date.getUTCHours()+":"date.getUTCMinutes()+":"+date.getUTCSeconds();
}
else
{
t = date.getHours()+":"date.getMinutes()+":"+date.getSeconds();
}
document.getElementById(container).innerHTML=t;
}
setInterval("getHeure('heure',false)", 1000);
@lambda2
Copy link
Author

lambda2 commented Nov 6, 2013

var webUrl = 'http://www.nanonull.com/TimeService/TimeService.asmx/getUTCTime'
    $.get(webUrl, function(data)
    {
        var ct = $(data).html().split(':');
        var fus = ct[1].slice(-2), heure = ct.[0], minutes = ct.[1].slice(0,2);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment