I have this code in visual basic. And I don't know how to get the same results in C# since there is no diff there. I can only do with the calculation of hours. How can I get the results in weeks and months?
Dim fechaActual As Date = Date.Today
Dim fechaFin As Date = New DateTime(2020, 12, 31)
Dim meses, semanas, horas As Integer
meses = DateDiff("m", fechaActual, fechaFin)
semanas = DateDiff("ww", fechaActual, fechaFin)
horas = DateDiff("h", fechaActual, fechaFin)
Console.WriteLine("Fecha actual: " & fechaActual)
Console.WriteLine("Fecha fin: " & fechaFin)
Console.WriteLine("Faltan: " & meses & "meses")
Console.WriteLine("Faltan: " & semanas & "" & "semanas")
Console.WriteLine("Faltan: " & horas & "horas"
What you can do is add the reference Microsoft.VisualBasic to be able to use the function > Microsoft.VisualBasic.DateAndTime.DateDiff
Example: