JavaScript - Como guardar la hora en una base de datos phpmyadmin

 
Vista:
sin imagen de perfil

Como guardar la hora en una base de datos phpmyadmin

Publicado por manuel (1 intervención) el 25/11/2017 18:17:02
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<table name = "HORA"  style ="width: 250px; height: 24px; position:absolute;left:885px; top:185px;" id="reloj" border='0'>
<tr>
<td><div  id='hora'></div></td>
<td><div>:</div></td>
<td><div id='minuto'></div></td>
<td><div>:</div></td>
<td><div id='segundo'></div></td>
</tr>
</table>
 
<script type="text/javascript">
Reloj();
function Reloj() {
var tiempo = new Date();
var hora = tiempo.getHours();
var minuto = tiempo.getMinutes();
var segundo = tiempo.getSeconds();
document.getElementById('hora').innerHTML = hora;
document.getElementById('minuto').innerHTML = minuto;
document.getElementById('segundo').innerHTML = segundo;
setTimeout('Reloj()', 1000);
str_hora = new String(hora);
if (str_hora.length == 1) {
document.getElementById('hora').innerHTML = '0' + hora;
}
str_minuto = new String(minuto);
if (str_minuto.length == 1) {
document.getElementById('minuto').innerHTML = '0' + minuto;
}
str_segundo = new String(segundo);
if (str_segundo.length == 1) {
document.getElementById('segundo').innerHTML = '0' + segundo;
}
}
</script>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
-1
Responder
Imágen de perfil de Alejandro
Val: 1.448
Plata
Ha mantenido su posición en JavaScript (en relación al último mes)
Gráfica de JavaScript

Como guardar la hora en una base de datos phpmyadmin

Publicado por Alejandro (532 intervenciones) el 09/12/2017 19:16:49
  • Alejandro se encuentra ahora conectado en el
  • chat de PHP
phpmyadmin no es una base de datos.
1
INSERT INTO tabla (campoHora) VALUES (CAST(GETDATE() AS TIME))
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar