Bunu deniyorum ama çalışmıyor ... neden?Bugün nasıl biliyoruz?
<html>
<body>
<script type="text/javascript">
var today=new Date(); //today is Nov 28, 2010
today.setHours(0);
today.setMinutes(0);
today.setSeconds(0);
document.write(today+" ");
var today2 = new Date("November 28, 2010");
document.write(today2 + " ");
if (today == today2) { document.write("==");
if (!(today > today2) && !(today < today2)) {document.write("== ");}
if (today > today2) { document.write("> ");}
if (today >= today2){ document.write(">= ");}
if (today < today2) { document.write("< ");}
if (today <= today2){ document.write("<= ");}
</script>
</body>
</html>
Ve hep bu olsun:
Sun Nov 28 2010 00:00:00 GMT+0900 (JST) Sun Nov 28 2010 00:00:00 GMT+0900 (JST) > >=
aynı olması, her iki tarih değil misin? Dolayısıyla, ben ==
baskılı almalısınız ama ... olmuyor;.. (
Tarih farkını veya belirli bir tarihin bugün olup olmadığını saptamanın bir yolunu hesaplamanın bir yolunu mu sordunuz? İlk soru için, bkz: http://stackoverflow.com/questions/41948/how-do-i-get-the-difference-between-two-dates-in-javascript. İkincisi, cevabımı kontrol et. – KooiInc
Cevaplar için hepinize teşekkür ederiz ... bu bir js denemesiydi;) – nacho4d