getDay()
returns the day of the week (0 = Sunday, 1 = Monday...)
You want getDate()
instead, and you will need to use the "0"+....slice(-2)
trick to ensure it is zero-padded too. And the same padding trick on the hours, minutes and seconds too.
Вопрос
We have a problem with different browsers. In Chrome everything works fine, but in firefox the code doesnt work.
Its this code:
currentTime = new Date();
var jaar = currentTime.getFullYear();
var maand = ('0' + (currentTime.getMonth() + 1)).slice(-2);
var dag = currentTime.getDay();
var uur = currentTime.getHours();
var minuut = currentTime.getMinutes();
var seconden = currentTime.getSeconds();
var huidigetijd = (jaar + '-' + maand + '-' + dag + ' ' + uur + ':' + minuut + ':' + seconden);
var gpsdatum = tijd;
var gpstime = new Date();
var gpsjaar = new Date(gpsdatum).getFullYear();
var gpsmaand = ('0' + (gpstime.getMonth() + 1)).slice(-2);
var gpsdag = new Date(gpsdatum).getDay();
var gpsuur = new Date(gpsdatum).getHours() + 1;
var gpsminuut = new Date(gpsdatum).getMinutes();
var gpsseconden = new Date(gpsdatum).getSeconds();
var gps = (gpsjaar + '-' + gpsmaand + '-' + gpsdag + ' ' + gpsuur + ':' + gpsminuut + ':' + gpsseconden);
if (gps >= huidigetijd){
var marker = new google.maps.Marker({
map : map,
position : point,
icon : chasericoon,
html : html
}); // einde var marker
markersArray.push(marker);
bindInfoWindow(marker, map, infoWindow, html);
};//einde gps timeout
I've tried something with " and ' but that doesnt make any sense. Can someone help me with this ?
Thank you!
Решение
getDay()
returns the day of the week (0 = Sunday, 1 = Monday...)
You want getDate()
instead, and you will need to use the "0"+....slice(-2)
trick to ensure it is zero-padded too. And the same padding trick on the hours, minutes and seconds too.