This seems like some开发者_JAVA技巧thing I should be able to find on Google but I'm not having much look.
I'd like to format a date as day/month. Only thing I've found it {0:M} which displays the information I want however the month written out like December rather than "12". I need to use 02/12 if possible due to space restrictions.
Thanks for any help!
You could try the following format:
{0:dd/MM}
Have you simply tried:
myDateTime.ToString(@"dd/MM");
Are you sure its ignoring your local computer regional settings ?
What happens if you do:
Console.WriteLine(date1.ToString("M", CultureInfo.CreateSpecificCulture("en-US")));
精彩评论