Javascript to extract just the date from the variable -


i have variable called

 var lastrundate = encodeuricomponent(trim($("#" + tdlastdateid).text())); 

which holds date value 10%2f14%2f2016%2011%3a17%20am.passing them in url query parameter.

  var redirect_page = '<%= resolveurl("~/gui/reviewnew.aspx") %>' + "?testdate=" + lastrundate; 

i need extract date without time before passing them in url. not extract date omit time it.any appreciated

in 1 line can that

var decoded = decodeuricomponent( lastrundate ).split(" ")[0]; 

but you'd better this

var decoded = decodeuricomponent( lastrundate ); decoded = decoded.split(" "); if( decoded.length > 0 ){     decoded = decoded[0]; }else{     //handle error } 

hope i've helped you


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -