P
Peter
Hi,
I want to calculate the time difference (in seconds,
minutes, days, etc.) between to DateTime values.
I expected some of the DateTime methods could do the job for
me, but after some search I came across the System.TimeSpan
method.
Following code seems to work correctly ..
string ss="2005-04-15 13:10:00";
string tt="2005-04-14 12:00:00";
date1 = DateTime.Parse(ss);
date2 = DateTime.Parse(tt);
System.TimeSpan ts = new
System.TimeSpan(date1.Ticks-date2.Ticks);
double min = ts.TotalMinutes;
Then the result for "min" equals 1510 minutes, what's
correct. But what is a tick in this context ?
Is this the "standard" method for this kind of calculation,
or is there an easier way to do this ?
Thanks !
Peter
I want to calculate the time difference (in seconds,
minutes, days, etc.) between to DateTime values.
I expected some of the DateTime methods could do the job for
me, but after some search I came across the System.TimeSpan
method.
Following code seems to work correctly ..
string ss="2005-04-15 13:10:00";
string tt="2005-04-14 12:00:00";
date1 = DateTime.Parse(ss);
date2 = DateTime.Parse(tt);
System.TimeSpan ts = new
System.TimeSpan(date1.Ticks-date2.Ticks);
double min = ts.TotalMinutes;
Then the result for "min" equals 1510 minutes, what's
correct. But what is a tick in this context ?
Is this the "standard" method for this kind of calculation,
or is there an easier way to do this ?
Thanks !
Peter