How to resolve the error message ‘Cannot implicitly convert type ‘string’ to ‘System.DateTime’ ‘ when using a DataReader

Platform: ASP.NET|Category: ADO.NET

Try

VB.NET

dim dt as DateTime = ctype( dr('hiredate').ToString(), DateTime)

C#

DateTime dt= ((DateTime) dr['hiredate']).ToString();