1

My string is like 3/29/2016 17:30.How to convert it into datetime in javascript? and I want to compare it with another date?

Jui Test
  • 2,399
  • 14
  • 49
  • 76
  • 3
    Possible duplicate of [How can I convert string to datetime with format specification in JavaScript?](http://stackoverflow.com/questions/476105/how-can-i-convert-string-to-datetime-with-format-specification-in-javascript) – brso05 Mar 29 '16 at 12:09
  • You can visit http://stackoverflow.com/questions/5510580/convert-string-to-datetime and http://stackoverflow.com/questions/476105/how-can-i-convert-string-to-datetime-with-format-specification-in-javascript Also refer : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse – Jui Shah Mar 29 '16 at 13:06

1 Answers1

0
var date= new Date("2016-03-29 17:30:00".replace(/-/g,"/"));

if date is dynamic then you have to break that using substring method and concat in above format.

Imad
  • 7,126
  • 12
  • 55
  • 112