开发者

How to convert a date which is given in CCYYMMDD format to MM/DD/CCYY using C#?

开发者 https://www.devze.com 2023-03-11 17:52 出处:网络
Can anyone help me to convert a date which is given in CCYYMMDD format to MM/DD/开发者_开发技巧CCYY format in C#.Assuming by \"CC\" you mean century, you should just parse it and reformat it:

Can anyone help me to convert a date which is given in CCYYMMDD format to MM/DD/开发者_开发技巧CCYY format in C#.


Assuming by "CC" you mean century, you should just parse it and reformat it:

DateTime date = DateTime.ParseExact("yyyyMMdd", text,
                                    CultureInfo.InvariantCulture);
string newText = date.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture);
0

精彩评论

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