Parse 'Date & Time' string in Javascript which are of custom format
问题 I have to parse a date and time string of format "2015-01-16 22:15:00". I want to parse this into JavaScript Date Object. Any help on this? I tried some jquery plugins, moment.js, date.js, xdate.js. Still no luck. 回答1: With moment.js you can create a moment object using the String+Format constructor: var momentDate = moment('2015-01-16 22:15:00', 'YYYY-MM-DD HH:mm:ss'); Then, you can convert it to JavaScript Date Object using toDate() method: var jsDate = momentDate.toDate(); 回答2: A better