You must be logged in to post your query.
Home › Forums › Chart Support › Showing a different Timezone time
Tagged: timestamp
Hi sunil,
Iam using Canvas JS line graphs currently,but finding some issues with the timestamp.
The issue is ,my timestamp when converted to date format shows IST(Indian Standard Time) but i want to convert the timestamp to another timezones time ,can u please help me with this?
Arun,
You have two options here.
First option is to convert timestamps to required timezone on the server side and serve the same.
Second option is to use libraries like momentjs on client side to convert your datetime values to required timezone.
Hope this helps.
— Sunil Urs
No sunil,
The same graphs are going to be viewed in different timezones, so the same set of timestamps are read as different times depending on the timezones. But i want to fix it to a particular timezone.
is there any other date format the canvas charts can understand,other than the
1.new Date(‘2010′,’0′,’3′,’10’,’10’) ie JS Date object or 2.Unix timestmap
Basically the chart supports JavaScript Date object apart from unix timestamp. Now you can use any of the available ways to create a JavaScript Date Object and assign it to dataPoint’s x property. Here is one way to do it in UTC.
This is a common requirement in most applications and one of the best ways to do the same is to send time in UTC from the server and then convert it to required timezone on the client side.
You must be logged in to reply to this topic. Login/Register