javascript - The date values are shown as NaN in IE and Mozilla, although works fine in Chrome -
all date, related values shown nan, although same js codes, works fine in chrome, giving me right values, here's section, of date codes.
var date = new date(data.list[s].dt_txt); var year = date.getfullyear();var month = date.getmonth()+1; var dat = date.getdate(); if(month<10){month='0'+month;}if(dat<10){dat='0'+dat;} var hr = date.gethours();var min = date.getminutes(); var sec = date.getseconds(); if(hour<10){hour='0'+hour;}if(minute<10){minute='0'+minute;}if(sec<10){sec='0'+sec} var ftime = hour+':'+minute+':'+sec; var fdate = year+'-'+month+'-'+dat; ///\\ var date = new date(data.list[s+1].dt_txt); hr = date.gethours();minute = date.getminutes();sec = date.getseconds(); if(hour<10){hour='0'+hour;}if(minute<10){minute='0'+minute;}if(sec<10){sec='0'+sec} var ttime = hour+':'+minute+':'+sec; c1.innerhtml='+fdate+'; c2.innerhtml=''+ftime+' '+ttime+''; c3.innerhtml=data.list[s].weather[0].main; javascript internet-explorer date mozilla nan
No comments:
Post a Comment