|
|
Postada em 07/02/2006 10:02 hs
pessoal, já está resolvido ... o meu colega fez ... public static DateTime ConverteFTypeDateTime(object o) { DateTime retorno; if (o.GetType() == typeof(System.String)) { try { retorno = Convert.ToDateTime(o); } catch(System.FormatException) { string aux = (string)o; if (aux.IndexOf("-") == -1 && aux.IndexOf("/") == -1 && aux.Length == 8) { try { retorno = Convert.ToDateTime(String.Format("{0}/{1}/{2}",aux.Substring(6,2),aux.Substring(4,2),aux.Substring(0,4))); } catch(Exception) { throw new Exception("Erro ao converter o tipo de dado!"); } } else { throw new Exception("Erro ao converter o tipo de dado!"); } } catch(Exception ex) { throw ex; } } else { retorno = (DateTime) Convert.ChangeType(o,typeof(DateTime)); } return retorno; } valeu!!!
|
|
|
|