Formatting DateTime to show only Date in ASP.net MVC

In ASP.net MVC Razor view, you might need to show just Date or Time given a DateTime object. Some naive approaches could be (.cshtml):

@String.Format("dd-MMM-yyyy", Model.TestDate)

@Model.TestDate.ToString("dd-MMM-yyyy")

@Html.TextBoxFor(x => x.TestDate, "{0:dd-MMM-yyyy}")

However, a better way could be overloading the ToString() function for DateTime object as in following helper extension method:.

/// <summary>
/// Converts a DateTime string to Date string. Also, if Date is 
/// default value i.e. 01/01/0001 then returns String.Empty.
/// </summary>
/// <param name="inputDate">Input DateTime property </param>
/// <param name="showOnlyDate">Pass true to show only date.
/// False will keep the date as it is.</param>
/// <returns>Formatted date string</returns>
public static string ToString(this DateTime inputDate, bool showOnlyDate)
{
    if (showOnlyDate)
    {
        string returnString;

        if (inputDate == DateTime.MinValue)
        {
            returnString = "N/A";
        }
        else
        {
            returnString = inputDate.ToString("dd-MMM-yyyy");
        }
        Return returnString;
    }
    return inputDate.ToString();
}

You can use this extension method in your view as @Model.testDate.ToString(true).

I think this is a cleaner and maintainable approach to support such functionality. For any change in display format, you need to change only in extension method.

Please feel free to share your feedback/comments.