-1

I use asp.net, I have a string format "01/29/2016". How I can format this string to "29/01/2016" output?. Because that value will be processed on report filtering,

Thank You,

Bcktr
  • 208
  • 1
  • 8
  • 22

3 Answers3

0

If it is a date value you can use Date.toString (dd/MM/yyyy) If not do a convertion of the string beforehand with DateTime.Parse (string)

0
DateTime.ParseExact (myString, "d", CultureInfo.InvariantCulture).ToString (@"dd/MM/yyyy");

This should do the trick for you

David Pilkington
  • 13,528
  • 3
  • 41
  • 73
0

First convert your string format to date time. use following

DateTime YourDate= DateTime.ParseExact(
            "01/29/2016",
            "MM/dd/yyyy",
            CultureInfo.InvariantCulture);

And then convert this date time to your required format.

string myDateString = YourDate.ToString("dd/MM/yyyy");
Mayur Lohite
  • 90
  • 1
  • 11