blob: ff827ef1ce9c5b652de295ecf288cf4d00a9fe57 [file] [log] [blame]
Dani Vilardellaae4e2d2020-09-22 17:33:39 +02001
2function getTimeAndDate() {
3 // Hora d'inici
4 hora_actual.setMinutes(0, 0, 0); // Arrodonir per baix els minuts
5 minuts = hora_actual.getMinutes() < 10 ? hora_actual.getMinutes().toString() + '0' : hora_actual.getMinutes().toString();
6 document.getElementById("inici").innerHTML = hora_actual.getHours().toString() + ":" + minuts;
7
8 // Hora de fi
9 hora_actual.setHours(hora_actual.getHours() + 1); // Sumar una hora
10 minuts = hora_actual.getMinutes() < 10 ? hora_actual.getMinutes().toString() + '0' : hora_actual.getMinutes().toString();
11 document.getElementById("fi").innerHTML = hora_actual.getHours().toString() + ":" + minuts;
12
13 // Data
14 dia = hora_actual.getDate();
15 mes = hora_actual.getMonth() + 1;
16 any = hora_actual.getFullYear();
17 data = dia.toString() + '/' + mes.toString() + '/' + any.toString();
18}
Dani Vilardell238a5472020-09-22 18:27:08 +020019
20function getDayFormat() {
21 dia = hora_actual.getDate();
22 if(dia < 10) return "0" + dia;
23 else return "" +dia;
24}
25
26function getMonthFormat() {
27 mes = hora_actual.getMonth() + 1;
28 if(mes < 10) return "0" + mes;
29 else return "" + mes;
30}
31
32function getYearFormat() {
33 any = hora_actual.getFullYear();
34 return "" +any;
35}