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

c# SetCompatibleTextRenderingDefault must be called before the first -

c++ - Fill runtime data at compile time with templates -

C#.NET Oracle.ManagedDataAccess ConfigSchema.xsd -