开发者

Date time day/month (02/12)

开发者 https://www.devze.com 2023-01-28 04:30 出处:网络
This seems like some开发者_JAVA技巧thing I should be able to find on Google but I\'m not having much look.

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")));
0

精彩评论

暂无评论...
验证码 换一张
取 消