Jaspreet Singh

Jaspreet Singh

  • NA
  • 20
  • 3.8k

Date difference Function

Nov 7 2019 4:19 AM
Hello Team,
 
I am facing an issue while identifying the difference in dates. Here is my code:-
 
using System;
namespace Date_Difference
{
class Program
{
static void Main(string[] args)
{
string z = "2018, 11, 06";
string a = "2019, 11, 11";

Console.WriteLine(DateDifference(z, a));
Console.ReadLine();

}
public static string DateDifference(string x, string y)
{
string difference = Convert.ToDateTime(y - x);
return difference;
}
}
}
 
Can someone please help me to fix this issue. 

Answers (6)