Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
3590
How to convert UTC to local time before data is plotted
posted

I have a XamDataChart with several StepLineSeries and I am now adding several ScatterSeries to the chart. When I added the StepLine sources I created new collections and convert all the datapoints' time to local time before I populate the collections, however, for the scatter series I already have all the data in a collection available to me but the time is in UTC. I am trying not to create a new collection just to reproduce all that data with the corrected time. Is there a way to point the scatter series to the collection but run a converter on all the datapoints before they are plotted?

Parents
  • 12875
    Verified Answer
    posted

    Mike,

    I'm not sure if I understand all that you said; why you are converting the datetime to local time. 

    But I would suggest that the datetimes could all remain in UTC time and you could use a standard datetime format string to convert to local time from the UTC time for a label, if that is required, in which case this link may be helpful to you.

    Standard Date and Time Format Strings

    http://msdn.microsoft.com/en-us/library/az4se3k1(v=VS.100).aspx

    To literally convert between time zones and UTC this may be helpful.  Let me know if you need to use a valueconverter.

    http://msdn.microsoft.com/en-us/library/bb397769.aspx

    You can also identify whether a datetime is UTC or local time when you declare the value.

     DateTime dtUTC = new DateTime(2012, 10, 15, 10, 10, 25,DateTimeKind.Utc);

     DateTime dtlocal0 = new DateTime(2012, 9, 25, 13, 10, 25,DateTimeKind.Local);

     

    Please let me know if this information is helpful to you. 

Reply Children
No Data