CSharp examples for System:DateTime Week
The time delta (in weeks) between the given start and end dates
using System.Collections; using System;//from www. j a va 2 s . co m public class Main{ /// <summary> /// The time delta (in weeks) between the given start and end dates /// </summary> /// <param name="begin">The DateTime object representing the start</param> /// <param name="end">The DateTime object represending the end</param> /// <returns>A double representing the total number of weeks between the two dates</returns> public static double DeltaWeeks(DateTime begin, DateTime end) { TimeSpan start = new TimeSpan(begin.Ticks); TimeSpan stop = new TimeSpan(end.Ticks); TimeSpan diff = stop.Subtract(start); return diff.TotalDays / 7; } }