I have an array of dates that have the datetime values till microseconds .
So myquestion is that how can I convert those values to a Timestamp values such as in the form of integer or float no's as the following type:
1578032412798
Here I have the array of dates as following :
var dates =["2020-14-03 11:14:48.225000","2020-14-03 11:14:48.225000","2020-14-03 11:14:48.226000","2020-14-03 11:14:48.226000","2020-14-03 11:14:48.227000","2020-14-03 11:14:48.227000","2020-14-03 11:14:48.228000","2020-14-03 11:14:48.228000","2020-14-03 11:14:48.228000","2020-14-03 11:14:48.229000","2020-14-03 11:14:48.229000","2020-14-03 11:14:48.229000","2020-14-03 11:14:48.230000","2020-14-03 11:14:48.230000","2020-14-03 11:14:48.230000","2020-14-03 11:14:48.231000","2020-14-03 11:14:48.231000","2020-14-03 11:14:48.231000","2020-14-03 11:14:48.231000","2020-14-03 11:14:48.232000"] ;
I am trying the following code. but it's not working :
dates.forEach((e) => {
var date = e.getTime();
console.log (date)});
Also I tried to implement the following mwthod. but its showing the values till hours only:
var dateString = dates,
dateTimeParts = dateString.split(' '),
timeParts = dateTimeParts[1].split(':'),
dateParts = dateTimeParts[0].split('-'),
date;
x = new Date(dateParts[2], parseInt(dateParts[1], 10) - 1, dateParts[0], timeParts[0], timeParts[1]);
mainval = x.getTime();
14in month of dates array?