- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
private DateTime GetDateTime(string elementDateTime)
{
try
{
string tempElementDateTime = elementDateTime;
string temp = tempElementDateTime.Remove(4, elementDateTime.Length - 4);
int year = Convert.ToInt32(temp);
tempElementDateTime = tempElementDateTime.Remove(0, 4);
temp = tempElementDateTime.Remove(2, tempElementDateTime.Length - 2);
int month = Convert.ToInt32(temp);
tempElementDateTime = tempElementDateTime.Remove(0, 2);
temp = tempElementDateTime.Remove(2, tempElementDateTime.Length - 2);
int day = Convert.ToInt32(temp);
tempElementDateTime = tempElementDateTime.Remove(0, 2);
temp = tempElementDateTime.Remove(2, tempElementDateTime.Length - 2);
int hour = Convert.ToInt32(temp);
tempElementDateTime = tempElementDateTime.Remove(0, 2);
temp = tempElementDateTime.Remove(2, tempElementDateTime.Length - 2);
int minute = Convert.ToInt32(temp);
tempElementDateTime = tempElementDateTime.Remove(0, 2);
temp = tempElementDateTime.Remove(2, tempElementDateTime.Length - 2);
int second = Convert.ToInt32(temp);
tempElementDateTime = tempElementDateTime.Remove(0, 2);
return new DateTime(year, month, day, hour, minute, second);
}
catch
{
return DateHelper.MinDateTime;
}
}
Комментарии (0) RSS
Добавить комментарий