Danny

Danny

  • NA
  • 1
  • 2.1k

DateTime.Parse error

Aug 25 2011 4:52 PM
Can anyone help?

I have a function that checks to see if a string passed is a date with the string "4AD2182"

DateTime.Parse("4AD2182") returns the following Result:

    {4/1/2182 12:00:00 AM}
    Date: {4/1/2182 12:00:00 AM}
    Day: 1
    DayOfWeek: Monday
    DayOfYear: 91
    Hour: 0
    Kind: Unspecified
    Millisecond: 0
    Minute: 0
    Month: 4
    Second: 0
    Ticks: 688334976000000000
    TimeOfDay: {00:00:00}
    Year: 2182

Is this a bug?

Thanks!

####### Code #########

public

{


static bool IsDate(object obj)//Determine if value is a Date data type



string strDate = obj.ToString();try

{





}


DateTime dt = DateTime.Parse(strDate);if (dt != DateTime.MinValue && dt != DateTime.MaxValue)return true;return false;catch

{


}

}

return false;

#############################3

Answers (1)