Home forums Using CanvasJS Showing a different Timezone time

Tagged: 

This topic contains 4 replies, has 2 voices, and was last updated by  Sunil Urs 2 years, 10 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #5680

    itsaruns90
    Participant

    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?

    #5684

    Sunil Urs
    Keymaster

    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

    #5686

    itsaruns90
    Participant

    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.

    #5687

    itsaruns90
    Participant

    Hi sunil,

    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

    #5689

    Sunil Urs
    Keymaster

    Arun,

    is there any other date format the canvas charts can understand,other than the

    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.

    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.

    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.


    Sunil Urs

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.