lundi 29 juin 2015

How to find the difference between two dates in No. of days:Hours:Minutes Format [duplicate]

This question already has an answer here:

How to Find Time Difference between Two dates for example if Date one:06-06-2015 04:10:10 Date Two:10-06-2015 05:12:10 ,Answer should be like 04:01:02. Number of day:- The exact days difference between two date. if days count exceeds 365 years can be added. Final format should be in String. Number of days fields refer the exact day difference between two days.

I tried The below code .

int noofdays=00;
int Hours=00;
int min=00;
if(item.StandardWorkingTime!=null && item.
 noofdays = (int)(d1.Subtract(d2)).TotalDays;
 Hours = (in)(d1.Subtract(d2)).TotalHours;
 min=(int)(d1.Subtract(d2)).TotalMinutes;

but it gives error. can anyone please help to me to find the solution.

Aucun commentaire:

Enregistrer un commentaire