Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
please provide some sample for work around this scenario.
Posted
Comments
Sergey Alexandrovich Kryukov 24-Sep-14 1:16am    
Why "without"? Excuse me, but don't you have anything more interesting to do than that?
"DateTime", by the way, is a struct.
—SA

"I would like to dig a hole without a shovel", well you can always use your hands, it wouldn't be very nice and hurt a lot but it is possible.

Tools are there to make life easier, so use them.
 
Share this answer
 
C#
//try following
public static void Main()
	{
		//first date
		DateTime dt1=DateTime.Parse("05/05/2005");
		//second date
		DateTime dt2=DateTime.Now;
		//Subtact dates
		TimeSpan ts =dt2.Subtract(dt1);		
		//result.
		Console.WriteLine(ts.Days);
	}


check link.
https://dotnetfiddle.net/BjfPjK[^]

if any issue then let me know.

->M.U
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900