Need parse dd.MM.yyyy to DateTime using TryParse

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

    try "ddMMyyy", without "- / ."

    0 讨论(0)
  • 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);
    }
    
    0 讨论(0)
提交回复
热议问题