Skip to Content

Filter by date and time

Dear Experts,

I want to concatenate date and time fields and do a query operation.

Currently , i have fromdate and todate (both date type) ;I use the below code to query

var result== Results.Where(dtRule => today.IsBetween(dtRule.FromDate, dtRule.ToDate)|| (dtRule.FromDate.ToString() == "" && dtRule.ToDate.ToString() == ""))

This is working fine to filter by dates.

But now business needs to add new filter by date also.So I have added 2 new fields fromtime and totime (both time datatypes).

Now how can i filter the results between fromdate+fromtime and todate+totime.

Thanks in advance.

Thanks,

Resmi

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Mar 27, 2017 at 11:14 AM

    Hello Resmi,

    Do you have Date and Time fields in your collection or also a DateTime field too?

    Bye,
    . Horst

    Add comment
    10|10000 characters needed characters exceeded