0

I have a string the represents a time "2014-07-03T11:47:00"

I would like to covert this time to milliseconds and I think it should look something like the following.

var myTime = Date.parse("2014-07-03T11:47:00");

var myTimeMs = myTime.getTime();

Any suggestions about how to get the value in milliseconds on any browser?

user3648646
  • 711
  • 2
  • 15
  • 24

1 Answers1

2

Date.parse returns the time in milliseconds

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse

Craig
  • 7,471
  • 4
  • 29
  • 46
  • But *Date.parse* is not generally consistent across browsers in use, so should not be relied upon to convert a string to a Date. – RobG Jul 09 '14 at 00:36
  • RobG, any suggestions on how to do it in a reliable way across browsers? – user3648646 Jul 09 '14 at 00:43