How do we remove quotes "" out of a string??
Hello Everyone,
I am tired of looking for an answer to remove quotes out of a string. Here is the scenario:
- var element = document.getElementById("DateTimeField");
- var value = element.value; //value is "2012,10,30 10:30:24"
- did some string operations of split and concatenation and now
- value = "2012,10,30,10,30,24" which is in the form of "yyyy,mm,dd,hh,mm,ss"
-
- var d = Date.UTC(value); gives NAN, bacause of the quotes
So i have to remove the quotes, This is what i have tried to remove quotes:
- value.replace(/['"]/g,'');
- value.replace(/["']{1}/gi,"")
- value.valueOf()
- parseInt(value)
- parseFloat(value)
- value.unquoted()
Nothing has worked, can someone suggest me how to achieve it?