1
.Where(x => x.POD_DATE == xDATEx)

I need to check if xDATEx is the same date as x.POD_DATE but xDATEx gives me results like 2011-07-17 00:00:00.000 and the x.POD_DATE gives 2011-07-17 01:15:43.577

How do I compare them, despite the results not being in a date only format?

0

2 Answers 2

2

http://msdn.microsoft.com/en-us/library/dd395596.aspx

using System.Data.Objects;

.Where(x => EntityFunctions.TruncateTime(x.POD_DATE) == EntityFunctions.TruncateTime(xDATEx))
Sign up to request clarification or add additional context in comments.

6 Comments

Error 2 The name 'EntityFunctions' does not exist in the current context
do you know any other way? i cannot fix it
you need to have the using directive for it at the top of your code file. Using System.Data.Objects;
dylan, can you please explain more i do not understand you answer:( how can i set a day after and do this: Where(x=>x.POD_DATE>=xDATEx && x.POD_DATE<=y1DAYAFTERy); ?
jakub, Error 2 The type or namespace name 'Objects' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
|
0
var xDate2 = xDATEx.AddDays(1);
var q = new OrderDataRepository()
               .GetAllOrderData()
               .Where(x => x.POD_DATE >= xDATEx && x.POD_DATE < xDate2)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.