toISOString() function not working.

toISOString() function not working.

I have this simple script to run-

  1. var date = '2016-01-01 00:00:00';
  2. var n = date.toISOString();

  3. alert(n);

But instead it returns error: Uncaught TypeError: date.toISOString is not a function

I want to convert the date string into ISO date format which is compatible with firefox. However its not working in Jquery. Is there a different function for ISO date format conversion for Jquery or is there any error in my script?