Q:

Select only records around a certain time

In my database, there's a record every single minute. I want to only select every record that's created around every fifteen minutes.
The following code shows how I currently execute this query, but with the statement: v.CreateTime > v.CreateTime < endDate), I'm only declaring between what dates I would like to get the data.
I want the data with times of :15, :30, :45, :00. Also the data in not entered in precisely at those times. For example 12:15:23 is possible, but 12:14.43 is also possible.
vafDataList = service.LoadVesselRecord<VafData>(v => 
      v.TypeNo == RecordObjectTypes.VafData && 
      v.Vessel_No == vesselNo && 
      v.CreateTime > startDate && 
      v.CreateTime < endDate)
  .OrderBy(t => t.CreateTime)
  .ToList();

How can I select only the records around the quarters of an hour, and not all records?

A:

You can simply select the records for those minutes:
.Where(t => new int[] { 0, 15, 30, 45 }.Contains(t.CreateTime.Minute))

However, assuming your LoadVesselRecord() calls a Where() that gets executed on a DbSet, Entity Framework can't translate that to a query, so you'll have to use the SqlFunctions extensions to let Entity Framework translate it to a DATEPART SQL statement:
.Where(t => new int[] { 0, 15, 30, 45 }
            .Contains(SqlFunctions.DatePart("minute", t.CreateTime)))

