0

I have one date in string format "dd/MM/yyyy hh:mm tt"

when I try to parse, the result is NaN

var test = Date.parse("15/2/2015 8:20 PM");

undefined

test

NaN

Community
  • 1
  • 1
Alex
  • 7,986
  • 27
  • 93
  • 150
  • 1
    Look at documentation https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse – Jenish Rabadiya Feb 16 '15 at 07:48
  • 1
    read this you will get idea http://stackoverflow.com/questions/5619202/converting-string-to-date-in-js – VRK Feb 16 '15 at 07:50

1 Answers1

2

Date expects US dates, so 2/15/2015. You can use a library like moment.js (http://momentjs.com/) to help you parsing international dates. JS does not allow this natively :(

Adrien
  • 1,815
  • 1
  • 11
  • 21