I want to replace all occurent of "-", ":" characters and spaces from a string that appears in this format:
"YYYY-MM-DD HH:MM:SS"
something like:
var date = this.value.replace(/:-/g, "");
                You were close: "YYYY-MM-DD HH:MM:SS".replace(/:|-/g, "")
/:-/g means ":" followed by "-".  If you put the characters in [] it means ":" or "-".
var date = this.value.replace(/[:-]/g, "");
If you want to remove spaces, add \s to the regex.
var date = this.value.replace(/[\s:-]/g, "");
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With