DateDiff() in C#

DateDiff() in C# private   double  DateDiff( string  howtocompare, System.DateTime startDate, System.DateTime endDate) 
DateDiff() in C#

DateDiff() in C#   
double diff=0
DateDiff() in C#   System.TimeSpan TS 
= new System.TimeSpan(endDate.Ticks-startDate.Ticks); 
DateDiff() in C#
DateDiff() in C#   
switch (howtocompare.ToLower()) 
DateDiff() in C#   

DateDiff() in C#    
case "year"
DateDiff() in C#     diff 
= Convert.ToDouble(TS.TotalDays/365); 
DateDiff() in C#     
break
DateDiff() in C#    
case "month"
DateDiff() in C#     diff 
= Convert.ToDouble((TS.TotalDays/365)*12); 
DateDiff() in C#     
break
DateDiff() in C#    
case "day":
DateDiff() in C#     diff 
= Convert.ToDouble(TS.TotalDays); 
DateDiff() in C#     
break
DateDiff() in C#    
case "hour"
DateDiff() in C#     diff 
= Convert.ToDouble(TS.TotalHours); 
DateDiff() in C#     
break
DateDiff() in C#    
case "minute"
DateDiff() in C#     diff 
= Convert.ToDouble(TS.TotalMinutes); 
DateDiff() in C#     
break
DateDiff() in C#    
case "second"
DateDiff() in C#     diff 
= Convert.ToDouble(TS.TotalSeconds); 
DateDiff() in C#     
break
DateDiff() in C#   }

DateDiff() in C#
DateDiff() in C#   
return diff;
DateDiff() in C#}
  
DateDiff() in C#
DateDiff() in C#
DateDiff() in C#

你可能感兴趣的:(datediff)