Int32 - Weeks

Returns a TimeSpan that represents a specified number of weeks, where the specification is accurate to the nearest millisecond.

Try it

public static void Main()
{
    Int32 [] values = { 1, 7, 30, 365, 1000, 2500, 10000, 15000, 32767 };

    Console.WriteLine("{0,21}{1,18}","Weeks", "TimeSpan");
    Console.WriteLine("{0,21}{1,18}","-----", "--------");

    foreach (Int32 value in values)
    {
		// C# Extension Method: Int32 - Weeks
        TimeSpan interval = value.Weeks();
        string timeInterval = interval.ToString();

        int pIndex = timeInterval.IndexOf(':');
        pIndex = timeInterval.IndexOf('.', pIndex);
        if (pIndex < 0) timeInterval += "        ";

        Console.WriteLine("{0,21}{1,26}", value, timeInterval);
    }
}

View Source
using System;

public static partial class Extensions
{
    /// <summary>
    ///     An Int32 extension method that weeks the given this.
    /// </summary>
    /// <param name="this">The @this to act on.</param>
    /// <returns>A TimeSpan.</returns>
    public static TimeSpan Weeks(this Int32 @this)
    {
        return TimeSpan.FromDays(@this*7);
    }
}