c# - How to get exact hours and minutes from DbFunctions.DiffMinutes() -
i using linq query,it works fine. problem is returning hours in int i.e 10,9 etc want complete hours along minutes i.e 10:28,9:45 etc
dayhours = (from ab in db.attendances ab.employee == 63 && ab.intime.value.year == 2015 && ab.intime.value.month == select new { day = ab.intime.value.day, hours = dbfunctions.diffminutes(ab.intime, ab.outtime) / 60 });
you can try this:
/*...*/ select new { day = ab.intime.value.day, hours = dbfunctions.diffminutes(ab.intime, ab.outtime) / 60 minutes = dbfunctions.diffminutes(ab.intime, ab.outtime) % 60 });
if don't want on format, please specify how want store (a timespan
variable? else?)
Comments
Post a Comment