How can I subtract two dates in C#
?
I have two variables DateTime
and I need to get the difference between them in hours.
DateTime fecharegistro = {04/05/2018 8:34:01} //obtenemos este valor de una base de datos
DateTime fechafin = DateTime.Now.Substract(fechaRegistro);
When compiling the above code I get an error saying that an object cannot be implicitly converted TimeStamp
to System.DateTime
, when the variable is DateTime
.