using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;


/// <summary>
/// Summary description for MSDateTime
/// </summary>
public static class MSDateTime
{

    /// <summary>
    /// Use system DateTime to parse, if unsuccessful return our
    /// mindate , 1/1/1900
    /// </summary>
    /// <param name="Date"></param>
    /// <returns></returns>
    public static DateTime Parse(string Date)
    {
        DateTime ret;
        if (Utility.IsNull(Date))
            ret = MSDateTime.MinDate;
        try
        {
            ret = DateTime.Parse(Date);
        }
        catch (Exception e)
        {
            ret = MSDateTime.MinDate;
        }
        return ret;
    }

    /// <summary>
    /// DateTime.mindate is not a valid SQL datetime and neither is null
    /// so we define our own mindate of 1/1/1900
    /// </summary>
    public static DateTime MinDate
    {
        get
        {
            return DateTime.Parse("1/1/1900");
        }
    }
}
