Can't you just cut of the last 6 chars of that string? You might then round the miliseconds and eventually add a second to you time object.
This is simpler and in one line:
new Date('01/09/2015 06:16:14.123'.split("."))
Many ways to Rome. The given code will return '(datestr=) 2011-4-4 19:27:39.92'. Is that what you look for?
var darr = '2011-04-04 19:27:39.92034'.split('.') , dat=new Date(darr) , datestr = ''; dat.setMilliseconds(Math.round(darr/1000)); datestr = [ [dat.getFullYear(),dat.getMonth()+1,dat.getDate()].join('-') ,' ', [dat.getHours(),dat.getMinutes(),dat.getSeconds()].join(':') ,'.', dat.getMilliseconds() ].join('');
JS built in Date class should be able to handle this, and getTime() can return milliseconds since start 1970 (UNIX time). Watch out for time zone issues though; the constructor may interpret the date/time as being local, but getTime()'s milliseconds since 1970 may be in UTC, baking in a conversion that is difficult to remove.
new Date("2011-04-04 19:27:39.92034").getTime() 1301941659920
- Convert Date to Milliseconds
- Populate Highcharts X-Axis With Dates Given a From And To Date
- How to populate a Highcharts axis with string formatted data from a PHP array
- How to convert string array to ints to use with Highcharts
- how to make barchart from date 1 until 31 with different value?
- Loading string data from table gets parsed as Date on Chrome - Highcharts
- How filter json data with date from datepicker Angular2 app
- Set HighCharts data from JSON string with setData() function
- Pass custom date object from jalali-moment library to time.Date option
More Query from same tag
- Ionic app doesn't show custom buttons from Highchart library
- Integrate Highcharts maps with react component
- Add 2 legends in one chart
- Angular highchart-ng installation
- How to draw a bar chart that one series has both positive and negative values in Highcharts?
- Highcharts not displaying data at some zoom levels
- How to control HightChart Pie Chart/Donut Chart label font-weight in config
- Cannot get Highcharts solidgauge stops to work in styled mode
- Highcharts - how to export chart with a custom legend?
- Highcharts - with datetime axis labels overlap
- How do I reshape my existing JSON to fit Highcharts
- highcharts. How to determine the coordinates of the point where the CLICK was made?
- How to draw disconnected straight lines over a graph?
- How to correspond tooltip title with the legends at the bottom in Highcharts?
- Highlight Highcharts Organization Chart nodes
- Turning HighChart into a stacked Bar Graph with Title
- Put favicon in middle of Highchart
- Column Chart: Click event to only trigger on drilldown series
- Highcharts series setData from ajax php procedure
- Move the legend a little bit higher
- "The "highcharts" property was not passed" warning with constructorType="chart"
- Highcharts, display marker on selected point only
- Create Phantomjs export server to convert highchart to image base64 string
- Highchart spline Chart with no markers and legends markers as circle's
- Highchart Axis Update/ chart redraw
- HighStock y-axis labels changing by itself when horizontal scroll moves
- How to check if Highcharts y-axis exists
- Highchart: Can I use a different variable as the data labels?
- Ajax Request to Insert Highcharts into Head and Run Function
- Get y point from x given point hightcharts