开发者

How can I use DateTime.Parse() with point separator?

I would like to parse a date like this "1.09.开发者_运维问答2011"? Should I use the IFormatProvider?

I know that I can try to replace the point with the replace method but i don't like the idea.


Try DateTime.ParseExact( myString, "d.MM.yyyy", CultureInfo.InvariantCulture);

EDIT

Change the format from "dd.MM.yyyy" to "d.MM.yyyy" to properly reflect Dran's input string.


DateTime.ParseExact allows you to specify a format string.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜