convert string date to date javascript code example
Example 1: convert string to localdatetime
String str = "2016-03-04 11:30";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
LocalDateTime dateTime = LocalDateTime.parse(str, formatter);
Example 2: js string to date
var myDate = new Date("2013/1/16");
var str = "2013/1/16";
var strToDate = new Date(str);
Example 3: parse date from string in js
Date.parse(dateString)
Example 4: string date to date in javascript
var ts = '1471793029764';
ts = Number(ts);
var date = new Date(ts);
var invalidDate = new Date('1471793029764');