var times=json.jsonArray[i].pubDate; var index=times.indexOf(" "); if(times.length>index){ times=times.substring(0,index); }