Click here to Skip to main content
16,018,347 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have a database table ApplicationErrorLog in which ErrorDate is stored in String format i have tried various examples on the net but nothing is working "Been stuck for two days" Want to get all the dates greater than the date(ErrorDateFilterValue ) coming from database (ErrorDate) ...
list = (from t in objPowerSchoolAdminPortalEntities.ApplicationErrorLogs
                           where t.ErrorDate.CompareTo(ErrorDateFilterValue) <= 0
                           select t).ToList();

Tried to make iQueryable but it didnt worked -
C#
AscendingQuery = AscendingQuery.Where(As => DateTime.Parse(DateTime.Parse(As.ErrorDate).ToShortDateString(), enUsDateFormat).ToString("yyyyMMdd") == ErrorDateFilterValue);

this is the date with which i want to compare it - ErrorateFilterValue
C#
IFormatProvider enUsDateFormat = new CultureInfo("en-US").DateTimeFormat;
                           objApplicationErrorLogModal.ErrorDateFilterValue = DateTime.Parse(TempDate.ToShortDateString(), enUsDateFormat).ToString("yyyyMMdd");

I Can Convert it to any format but not the one coming from Database .
any kind of suggestions and help will be appriciated .
Thanks IN Advance.
Posted
Updated 23-Apr-14 20:34pm
v2

1 solution

Try this , it may help

Compare Datetime in Linq Query[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900