Andreu Huguet | 8d2e08f | 2020-09-17 14:15:23 +0200 | [diff] [blame^] | 1 | <html> |
| 2 | <head> |
| 3 | </head> |
| 4 | <body> |
| 5 | <h1>App de traçabilitat DAFME</h1> |
| 6 | <h2>Estructures Algebràiques</h2> |
| 7 | <h3>Aula S03</h3> |
| 8 | <a href="#">No és així? Canvia-ho.</a> |
| 9 | |
| 10 | <h2 id="hora"> |
| 11 | <span id="inici"></span> - |
| 12 | <span id="fi"></span> |
| 13 | </h2> |
| 14 | <h3 id="data"></h3> |
| 15 | <a href="#">No és així? Canvia-ho.</a> |
| 16 | |
| 17 | <script> |
| 18 | var hora_actual = new Date(); |
| 19 | var minuts; |
| 20 | |
| 21 | // Hora d'inici |
| 22 | hora_actual.setMinutes(0, 0, 0); // Arrodonir per baix els minuts |
| 23 | minuts = hora_actual.getMinutes() < 10 ? hora_actual.getMinutes().toString() + '0' : hora_actual.getMinutes().toString(); |
| 24 | document.getElementById("inici").innerHTML = hora_actual.getHours().toString() + ":" + minuts; |
| 25 | |
| 26 | // Hora de fi |
| 27 | hora_actual.setHours(hora_actual.getHours() + 1); // Sumar una hora |
| 28 | minuts = hora_actual.getMinutes() < 10 ? hora_actual.getMinutes().toString() + '0' : hora_actual.getMinutes().toString(); |
| 29 | document.getElementById("fi").innerHTML = hora_actual.getHours().toString() + ":" + minuts; |
| 30 | |
| 31 | // Data |
| 32 | var dia = hora_actual.getDate(); |
| 33 | var mes = hora_actual.getMonth() + 1; |
| 34 | var any = hora_actual.getFullYear(); |
| 35 | var data = dia.toString() + '/' + mes.toString() + '/' + any.toString(); |
| 36 | document.getElementById("data").innerHTML = data; |
| 37 | </script> |
| 38 | </body> |
| 39 | </html> |