AnsweredAssumed Answered

AFTimeRange localtime versus UTC time

Question asked by skdesiraju on Feb 7, 2018
Latest reply on Feb 8, 2018 by skdesiraju

Hello I am calling a function to that gets PI tag recorded values for a date range. In this case I need the data from 1/1/2017 - 2/1/2017

var x = funs.GetPiTagRecordedValues("someTag", Convert.ToDateTime("01-jan-2017"), Convert.ToDateTime("01-feb-2017"), true);


This is in the GetPITagRecordedValues function


   PIPoint point = PIPoint.FindPIPoint(piserver, TagName);


   AFTimeRange time = new AFTimeRange(startDate, endDate);


   AFValues values = point.RecordedValues(time, AFBoundaryType.Inside, null, false, 0);


What I noticed in in AFTimeRange, localTime for start and end dates are 12/31/2016 6:00 pm and 1/31/2017 6:00 pm. It looks like the date is getting converted to the GMT time. Where as the UTC time always shows the right time that we are passing. It looks like it is quering the tag values based off of the localtime and excluding me recorded values between 1/31/2017 6pm to midnight. How can I make the AFTimeRange to take 1/1/2017 instead on -6 hrs?


Thanks in advance for the help