- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
GetDate(string dateTimeText){
DateTime date = new DateTime();
String[] parsedDate = dateTimeText.Split('/');
bool allNumbers = true;
foreach (string s in parsedDate)
{
int value;
if (!int.TryParse(s, out value) && allNumbers)
{
allNumbers = false;
}
}
if (parsedDate.Length == 3 && allNumbers)
{
String newDateText = parsedDate[1] + "/" + parsedDate[0] + "/" + parsedDate[2];
DateTime.TryParse(newDateText, out date);
}
return date;
}
codemonkey 05.01.2015 18:29 # +3
someone 06.01.2015 10:13 # +2
chtulhu 06.01.2015 11:11 # +2