Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

nettotma14

Data e Hora com segundos..

Recommended Posts

Olhem meu código:

 

<html><script>var dayarray=new Array("Domingo","Segunda","Terça","Quarta","Quinta","Sexta","Sábado")var montharray=new Array("Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro")function getthedate(){var mydate=new Date()var year=mydate.getYear()if (year < 1000)year+=1900var day=mydate.getDay()var month=mydate.getMonth()var daym=mydate.getDate()if (daym<10)daym="0"+daymvar hours=mydate.getHours()var minutes=mydate.getMinutes()var seconds=mydate.getSeconds()var dn="AM"if (hours>=12)dn="PM"if (hours>12){hours=hours-12}if (hours==0)hours=12if (minutes<=9)minutes="0"+minutesif (seconds<=9)seconds="0"+seconds//change font size herevar cdate="<font color='B32D00' face='Verdana' size='1'>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+" - "+hours+":"+minutes+":"+seconds+" "+dn+"</b></font>"if (document.all)document.all.clock.innerHTML=cdateelse if (document.getElementById)document.getElementById("clock").innerHTML=cdateelsedocument.write(cdate)}if (!document.all&&!document.getElementById)getthedate()function goforit(){if (document.all||document.getElementById)setInterval("getthedate()",1000)}var current = 0var x = 0var speed = 100 //tempo de preenchimentovar speed2 = 2000 //tempo de esperafunction initArray(n) {this.length = n;for (var i =1; i <= n; i++) {this[i] = ' '}}typ = new initArray(4) //quantidade de mensagens//querendo por mais mensagens, copie a linha e mude o número obedecendo a sequência.typ[0]="Bem vindo ao novo site do Projeto Libras é Legal..."typ[1]="www.libraselegal.com.br"typ[2]="Patrocínio: Petrobras"typ[3]="Parceiro: Consultor Social ( www.consultorsocial.com.br )"function typewrite() {var m = typ[current]window.status = m.substring(0, x++) + "_" //este é o caracter que aparece preenchendo o textoif (x == m.length + 1) {x = 0current++if (current > typ.length - 1) {current = 0}setTimeout("typewrite()", speed2)}else {setTimeout("typewrite()", speed)}}typewrite()</script><body onLoad="goforit()"><span id="clock"></span></body></html>

Intão galera funciona corretamente porém eu queria que as horas fikasem corretamente... sendo assim... 5 horas da tarde apareceria 17:00 e assim por diante.. como ficaria meu código pra funcionar desse jeitu galera?

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.