0

In AngularJS I'm trying to use the Date() function to get milliseconds from

'2014-11-19 10:58:16'

With this function

var n = new Date.parse('2014-11-19 10:58:16');

But I'm getting a weird error

TypeError: function parse() { [native code] } is not a constructor

How can I fix this?

2
  • 1
    Why are you using new in this context? (This does not have much to do with Angular, by the way.) Commented Nov 19, 2014 at 10:35
  • That just totally fixed it! I thought, because of the error, it had something to do with AngularJS Commented Nov 19, 2014 at 10:36

1 Answer 1

1

As Frédéric Hamidi posted in the comment I shouldn't have used

new Date

but

Date

Thank you Frédéric Hamidi

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.