我希望在早上7点到下午3点之间获取数据但是我在下午12点到下午5点之间收到记录,因为我没有在最后一句“a.timestamp.Hour > 7 && a.timestamp.Hour < 13)
”中转换为IST小时数小时。如何将utc时间转换为IST小时,以便我可以获得所需的数据。
var reader = new StreamReader(stream, encoding);
var responseString = reader.ReadToEnd();
var Pirs = Newtonsoft.Json.JsonConvert.DeserializeObject<List<AssetDetail>>(responseString);
var items = Pirs
.Where(a =>
!a.dataFrame.EndsWith("AAAAAAAAAAA=") &&
(fromDate == null ||
fromDate.Value.Date <=
TimeZoneInfo.ConvertTimeFromUtc(Convert.ToDateTime(a.timestamp),
TimeZoneInfo.FindSystemTimeZoneById("India Standard Time")).Date) &&
(toDate == null ||
toDate.Value.Date >=
TimeZoneInfo.ConvertTimeFromUtc(Convert.ToDateTime(a.timestamp),
TimeZoneInfo.FindSystemTimeZoneById("India Standard Time")).Date) &&
a.timestamp.Hour > 7 && a.timestamp.Hour < 13)
.GroupBy(a => a.dataFrame.Substring(a.dataFrame.Length - 12))
.Select(g => g.First()).OrderBy(a => a.timestamp);
示例数据
timestamp "2017-07-21T18:26:01.004Z"