Function to return only date
<p>I have made a function to convert a textbox value to date. 
I want to store the converted date in a datetime field in my business object with only date and not time like in format(yyyy-MM-dd)</p>

<p>My function is returning date along with time</p>

<pre><code>public static DateTime ExtractDate(string myDate)
{
    DateTime result = DateTime.MinValue;
    if (myDate != null)
    {
        try
        {
            result=DateTime.Parse(myDate, new System.Globalization.CultureInfo("en-CA", true), System.Globalization.DateTimeStyles.AdjustToUniversal).ToString("yyyy-MM-dd");
        }
        catch (Exception)
        {
            throw new ApplicationException("DateTime conversion error");
        }
    }
    return (result.Date);
}
</code></pre>
