c# - How to get records between 7am and 3pm in ist from utc time zone in linq query -


i want data between 7am , 3pm i'm getting records between 12pm 5pm because did not converted ist hours hours chek in last clause "a.timestamp.hour > 7 && a.timestamp.hour < 13)". how convert utc time ist hours can desire data.

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); 

sample data

timestamp   "2017-07-21t18:26:01.004z" 


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -