//Purpose : This method would convert number format date data into date.
//Parameters : Number format string would be passed. Eg: 12281990
//Return Value : Date. Eg: 12/28/1990Public
private DateTime Number2Date(long lNum)
{
string strNum = lNum.ToString();
int iDay, iMon, iYear;
DateTime ValidDate = DateTime.Now;
try
{
//If date is not in valid format
if (strNum.Length == 7)
strNum = "0" + strNum;
iMon = Convert.ToInt32(strNum.Substring(0, 2));
iDay = Convert.ToInt32(strNum.Substring(2, 2));
iYear = Convert.ToInt32(strNum.Substring(4, 4));
ValidDate = new DateTime(iYear, iMon, iDay);
}
catch(Exception Ex)
{
//Ex.Message
}
return ValidDate;
}