0

I have a data set like this

temperature,Timezone
45,2019-08-01 12:34:34 CEST+0200
90,2019-08-01 12:34:35 CEST+0200
25,2019-08-01 12:34:36 CEST+0200
3,2019-08-01 12:34:37 CEST+0200
98,2019-08-01 12:34:38 CEST+0200
32,2019-08-01 12:34:39 CEST+0200
96,2019-08-01 12:34:40 CEST+0200
55,2019-08-01 12:34:41 CEST+0200
57,2019-08-01 12:34:42 CEST+0200
20,2019-08-01 12:34:44 CEST+0200
41,2019-08-01 12:34:45 CEST+0200
29,2019-08-01 12:34:46 CEST+0200
48,2019-08-01 12:34:47 CEST+0200
56,2019-08-01 12:34:48 CEST+0200
56,2019-08-01 12:34:49 CEST+0200

This is the data which is in the csv and when i convert this data to json by angular package so it will convert the Timezone values to string and that's why when these values are passing to Highcarts series data so graph(Highcarts line graph) is not plotting. Actually this time is converted in specific timezone so that's why i want to show the time exactly in the csv. So how can i achieve this?

Bhagwat Tupe
  • 1,905
  • 1
  • 13
  • 28
Fahad Subzwari
  • 2,109
  • 3
  • 24
  • 52
  • Highcharts uses time in milliseconds. Convert all your times to milliseconds since 1970 and it should work. More information here: https://www.highcharts.com/docs/chart-concepts/axes – ewolden Aug 02 '19 at 08:42
  • @ewolden how can i convert my all times into milliseconds since 1970 in specific timezone? because the time which is in my csv is in `CEST` timezone so how can i convert this time(CEST timezone) into milliseconds(CEST timezone)? can you give me an example? – Fahad Subzwari Aug 02 '19 at 09:24
  • @ewolden i didn't find a way to convert datetime in specific timezone milliseconds time. – Fahad Subzwari Aug 02 '19 at 09:40
  • Working with timezones is tricky. I suggest you use moment and moment timezone to sort out the timezones and get milliseconds from your date strings. See here for usage: https://jsfiddle.net/ewolden/8Lnoyvm4/24/ – ewolden Aug 02 '19 at 10:06
  • is there any way to pass original timestamp in unix patter in series of highcharts and only display to users that time in specific timezone like `Europe/Berlin` in x axis label? How can i display that converted time in x axis label? – Fahad Subzwari Aug 02 '19 at 10:09
  • You can format your labels to whatever you like: https://api.highcharts.com/highcharts/xAxis.labels.formatter – ewolden Aug 02 '19 at 10:41
  • Hi @Fahad Hassan Subzwari, Please check this thread: https://stackoverflow.com/questions/20867562/create-a-date-object-with-cet-timezone, it can be useful for you. – ppotaczek Aug 02 '19 at 11:00

0 Answers0