Saturday 15 January 2011

.net - C# date doesnt remove leading zero for non en-us locale -


I do not want a leading zero in front of month or day, this N-US

  Datetime .Now.ToString ("d") works fine; // "3/17/2015"  

However for N-GB I do not want to be in front of the month. I expect the resutl "17/3/2015" but I get the output I am now -

  DateTime.Now.ToString ("d") // "17/03/2015"  

Locally for Japan I'm getting 0 a month ago.

DateTime.Now.ToString ("d") // "2015/03/17"

I am setting up a culture in the current thread < / P>

  threads Present. Garbage = Agriculture = Culture. Information.  

Thank you in advance

Because the day is not right or In the first place on the left side you will get leading zero

If you do not have to do this:

  .stost ("yyyy / m / d")  

Or nothing like this with your favorite order:. .string ("d")


No comments:

Post a Comment