Posts: 6
Joined: Tue Feb 07, 2012 10:45 am

Sample for data module's parseDate feature

Mon Aug 12, 2013 12:38 pm

New data module is great! However, by default only supports datetime format "YYYY-MM-DD". So if you like to add datetime formats other than the default, (i.e "YYYY-MM-DD HH:MM:SS") below is the code piece you may use:

Code: Select all

data: {
	table: document.getElementById('your_own_table_id_name'),
	parseDate: function(val){
		var matched;
		if (typeof val === 'string') {
			matched = val.match('^([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})$');
			if (matched){
				return Date.UTC(+matched[1], matched[2] - 1, +matched[3], +matched[4], +matched[5], +matched[6]);

Return to “Highcharts Usage”