SoFunction
Updated on 2025-03-07

C# simple example of time difference


// Calculate the number of seconds required for a time-consuming task

public int GetTimeSpan(DateTime dtStart, DateTime dtEnd)

{

TimeSpan tsStart = new TimeSpan();

TimeSpan tsEnd = new TimeSpan();

TimeSpan ts = (tsStart).Duration();//sec

//dateDiff = () + "days" + () + "hours" + () + "minutes" + () + "seconds";

return ;

}