[Solved] How to Format a date pass as a parameter to a function and return data is a string with “yyyy/mm/dd” format?


    public string GetFormattedDate(String MyDateTime)
    {
        //Formating should happen here.
        DateTime dt = DateTime.Parse(MyDateTime);
        return dt.ToString("yyyy/MM/dd");            
    }

also can be done with this

 string dt = DateTime.Parse(txtDate.Text.Trim()).ToString("yyyy/MM/dd", CultureInfo.InvariantCulture);

4

solved How to Format a date pass as a parameter to a function and return data is a string with “yyyy/mm/dd” format?