Need parse dd.MM.yyyy to DateTime using TryParse

前端 未结 8 1804
孤街浪徒
孤街浪徒 2021-01-17 09:51

I need to parse string to DateTime. The string is always in the following format

\"10.10.2010\" That means dd.MM.yyyy, separated with dots.

I want to use Dat

8条回答
  •  无人及你
    2021-01-17 10:35

    Why not use ParseExact instead?

    var theDate = DateTime.ParseExact("dd.MM.yyyy", yourDateString, CultureInfo.InvariantCulture);
    

提交回复
热议问题