Very good question.
The dates are taken from a free fpw2.6 data table. The dates are in character format ie: "dd/mm/yy".
The data in the free tables is over 15 years old and I am stuck with dates being formatted in this way. I pass the dates to my method and then convert to date via:
public string OrthoAge(string tcRefDate)
{
DateTime dRefDate = DateTime.Parse(tcRefDate)
.......
.......
return dRefDate.ToString()
}
Once I have the old fpw character dates converted I can do what I have to (ie: lots of date math). I just need a way to make certain that the date converts from character to DateTime without throwing an error. I could wrap the conversion-to-date in a try/ catch construct but I was wondering if there was a better way.
Regards,
Neil
>
>>Can someone please offer a way to validate that a date passed as a parameter to a method is in fact a valid date prior to it being passed to the method.
>
>Silly question, but why would you need to? A DateTime variable will be a valid date.