Last post Nov 18, 2014 07:39 AM by PatriceSc
Nov 18, 2014 07:02 AM|binumon03|LINK
In my application i geting value from api. I taking api values in xml format. Now i need to some filteration on basis of time. storing time value from xml to string like
Now i had two dropdownlist containing starttime and endtime thats containing values like 08:00AM,08:15AM .........
my requirment is when i select time from dropdown list i need to compare values stored above variable my desired code is
DateTime f1 = DateTime.Parse(ftime) dropdown value
DateTime t1 = DateTime.Parse(ttime);dropdown value
DateTime s1 = DateTime.Parse(sTime);xml value
DateTime e1 = DateTime.Parse(eTime);xml value
if ((f1 > s1) && (e1 > t1))
istime = true;
in this case if select 07:00 AM and 02 :00PM from dropdownlist its failing. anybody can give me correct solution to this
Nov 18, 2014 07:39 AM|PatriceSc|LINK
Knowing how it fails always help. Is the problem that a conversion fails? If not have you tried to see which values you have exactly in f1,t1,s1,e1?
For now my understanding is something like f1 being 7AM and s1 maybe 8 AM so already f1>s1 would be false ??
Edit: see http://msdn.microsoft.com/en-us/library/y740d9d3.aspx You can run your code line by line and inspect values using
http://msdn.microsoft.com/en-us/library/esta7c62.aspx which seems basic debugging steps you could have done...