score:0

Accepted answer

i believe all you need to do is format/consider for utc. highcharts default is utc (0). (http://api.highcharts.com/highcharts#global) if you change to this:

function appendads(date1) {
   alert(new date(date1).toutcstring());
   $('#tabletitle').html("<u>info for " + timeconverter(date1) + ":</u>");
   ...
}

(fiddle) http://jsfiddle.net/j8cte/34/

you will see that it shows correct date with that "toutcstring()" added. you will likely want to convert it to something more pleasant to read, but remember that you will have to keep utc in mind if you don't use "toutcstring()".

update: i wanted to explain that i used "toutcstring()" since it was quick and something i knew off the top of my head. this method wouldn't work for all things, such as further down in your appendads function since it is a string. to explain utc and date formatting, parsing and manipulation in full would be too much for this post. but i will try to go over a few key points when dealing with dates on the web. also, please see mdn for other date info (https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/date).

if you need accurate information and/or logic for dates, you will need to know the date format you get (from server, database, etc...) - whether it is utc or not, for example. then you need to consider if it needs to be manipulated for display (such as for the viewers browser's timezone). and finally, if that date is being used internally, you need to consider if, when, and where you need to convert it once again (as appropriate).


Related Query

More Query from same tag