score:0
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.
score:0
this is simpler and in one line:
new date('01/09/2015 06:16:14.123'.split(".")[0])
score:2
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[0])
, datestr = '';
dat.setmilliseconds(math.round(darr[1]/1000));
datestr = [ [dat.getfullyear(),dat.getmonth()+1,dat.getdate()].join('-')
,' ',
[dat.gethours(),dat.getminutes(),dat.getseconds()].join(':')
,'.',
dat.getmilliseconds()
].join('');
score:9
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
Source: stackoverflow.com
Related Query
- Convert from string with milliseconds to date object Javascript
- Rails - convert date string into javascript date object for highcharts
- highcharts: convert useUTC=true milliseconds to javascript Date object
- Highcharts: convert string to an object with javascript
- c# WPF Webbrowser with Highchart, Javascript from external source not working "An error has occurred in the script on this page"
- Convert Javascript Object to array of arrays with two values
- Convert Date to Milliseconds
- Populate Highcharts X-Axis With Dates Given a From And To Date
- How to convert a JavaScript object to array
- How to populate a Highcharts axis with string formatted data from a PHP array
- String with multiple whitespaces on javascript
- Date / Time problem in javascript with highcharts
- passing formatting JavaScript code to HighCharts with JSON
- How to update a Javascript object with a function
- how do you convert epoch to readable date format in javascript
- Array split with the help of object categories values of array- Javascript - High Chart
- How to convert string array to ints to use with Highcharts
- Convert javascript datetime object to the format acceptable by highcharts Date.UTC(2014, 0, 2)
- javascript array object doesn't work with Hicharts when defined through jinja (Django 2.0)
- Prevent from executing previous JavaScript with turbolinks and highcharts //LazyHighCharts
- how to make barchart from date 1 until 31 with different value?
- How to configure date in Grantt chart of (Highcharts) so it accept date in string without javascript date?
- 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
- Javascript - convert HTML div with SVG to image
- Creating array from javascript object
- How to convert datetime to epoch time in milliseconds javascript
- Pass custom date object from jalali-moment library to time.Date option
- Convert c# date to Javascript
More Query from same tag
- Implements Time series chart Highcharts in Angular 4
- How to get multiple series data in tooltip highcharts (Without loosing tooltip pointer arrow)
- Highchart: incorrect candle chart for day saving time DST
- Highcharts Pie Chart from Ajax
- Highcharts label behind the second series (but above the first series)
- Highcharts AreaRange Chart issues with xAxis and last data point label
- How to do Drilldown in Piechart of Highchart?
- Highcharts: tickInterval on coloraxis
- Reading uploaded csv file in highcharts
- After setting the yAxis max value, some datalabels are not showing
- Highchart points not set to y asix
- highcharts filename from canvas
- Highcharts: multiple heatmaps with shared color bar
- Highcharts: series does not update if previous array only had null values
- Highcharts dataLabels allowOverlap not working
- Data labels are repeated in IE
- HighStock navigator from a stacked area chart shows wrong series
- How to Get element properties from Highchart
- Highchart series style on button click
- Highcharts display priority of overlapping labels
- Is it possible to define custom technical indicators, that takes 2 series as input?
- Adding highcharts to mapbox popup from CSV?
- Problem with multiple labels in Highchart
- Select dynamic value with tooltip on line chart (highcharts) in angular with material slider
- Display series stack label on chart
- Change color of series in bar chart?
- Scatter Bubble chart without Y axis in HighChart
- How to create dashed bar graph in highcharts
- How To Merge Highcharts Legends With All Unique Entries
- highcharts javascript variables