Thursday, October 13, 2011

Date Formatting in C# with region and sql compatible

 public string myDateFormat(string p)
    {
        // throw new NotImplementedException();

        IFormatProvider provider = new System.Globalization.CultureInfo("en-CA", true);
        String datetime = p.ToString();
        DateTime dt = DateTime.Parse(datetime, provider, System.Globalization.DateTimeStyles.NoCurrentDateDefault);
        return dt.ToString();
    }

No comments:

Post a Comment