I would like to easily check dates in this format and only in this format. Any otehr format should be considered invalid.
You use DateTime.ParseExactor DateTime.TryParseExact. You go through the exact format string.
DateTime.ParseExact
DateTime.TryParseExact
In your case, the format string will be d-MMM-yyyy(see here ) and can be used as follows:
d-MMM-yyyy
string dateString = "31-JUL-2010"; string format = "d-MMM-yyyy"; DateTime result = DateTime.ParseExact(dateString, format, CultureInfo.InvariantCulture);
Dim DateToTest As String = "01-Apr-1964" Dim ResultDate As Date Date.TryParseExact(DateToTest, "dd-MMM-yyyy", Globalization.CultureInfo.InvariantCulture, Globalization.DateTimeStyles.AllowWhiteSpaces, ResultDate)
, VB.NET, :
/[0-9] {2} - [A-Za-Z] {3} - [0-9] {4}/
, .
Source: https://habr.com/ru/post/1742568/More articles:How to insert several thousand columns in sqlite3? - pythonHow to get the same cursor (hand) on links in all browsers? - cssCodeDom: компилировать частичный класс - reflectionSQL Server Compact - how to check an encrypted SDF file? - sql-server-ceDynamic Typed Language Example Using ANTLR - typesiPhone шутер игры пуля физики! - iphoneWhat is a good Perl CGI tutorial? - perlThe mysql and GWT character set issue - mysqlHow to allow idlj to compile idl files in ant - javaКак правильно выполнить SQL UPDATE с взвешенным подзапросом? - sqlAll Articles