Hi,
In my ASP.NET MVC application, I want to know how can I calculate the dates between two date-time columns.
The issue is one column is date-time and the other column is date-time? (accepting null value)
Assume: CreateDate is a date-time column
Garment Date is date-time ? column
So I want to get TotalDays= (GarmentDate - CreateDate)
Example : Totaldays = (2022-03-07 14:09:27.530 - 2022-03-10 14:57:28.840)
So far I have done
var report = (from prodMovmnt in db.ProductionMovements
join productMain in db.Products on prodMovmnt.ProductId equals productMain.Id
join sizeMain in db.ProductSizes on prodMovmnt.ProductSizeId equals sizeMain.Id
where prodMovmnt.Status == true && prodMovmnt.Movement == "G" && prodMovmnt.Garment_Date < DateTime.Now
select new GarmentHelds
{
ProductName = productMain.Name,
DressCode = prodMovmnt.ProdCode,
ProductSize = sizeMain.Size,
CuttingDate = prodMovmnt.Cut_Date,
GarmentDate = prodMovmnt.Garment_Date,
HeldDays =
}).ToList();
Here I want to get value to HeldDays