Need parse dd.MM.yyyy to DateTime using TryParse

前端 未结 8 1791
孤街浪徒
孤街浪徒 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:48

    Brazil codec

    public static bool IsDateTime(string txtDate)
    {
       DateTime tempDate;
    
       return DateTime.TryParseExact(txtDate,"dd/MM/yyyy",
                                     new CultureInfo("pt-BR"),
                                     DateTimeStyles.None, out tempDate);
    }
    

提交回复
热议问题