Fetch (Retrieve) records based on Date using AngularJS in ASP.Net

mahesh213
 
on Feb 18, 2020 11:31 PM
1143 Views

Hi,

In database In Datefiled I have date and time in that particular field

Ex:12-1-2019 12:12:00

currently my requirement is that i need to fecth records only based upon date

i don't want to check time

currently issue in below code is that it was checking date and time

if both date and time matches then only it was dispalying records

i need to fecth records based upon date

Dynamically add rows from controller based on Date range using AngularJS in ASP.Net MVC

could you please help me

Download FREE API for Word, Excel and PDF in ASP.Net: Download
mahesh213
 
on Feb 18, 2020 11:54 PM

I have done solution from my end

            for (DateTime? i = Fdate; i <= tdate; i = i.Value.AddDays(1))
            {
                List<DateTime?> dates = items.Select(x => x.Date).ToList();
                if (dates.Contains(i))
                {
                    var employeeItem = items.Where(x => x.Date .Date== i.Date).FirstOrDefault();
                    ItemList.Add(new
                    {
                        ItemId = employeeItem.ItemId,
                        ItemName = employeeItem.ItemName,
                        EId = employeeItem.EId,
                        EName = employeeItem.EName,
                        Date = i.Value.ToString("dd/MM/yyyy")
                    });
                }
            }