MySqlDataReader for TIME ?

Posted on 2009-02-09
Last Modified: 2013-12-17
When I try to read the MySql database field of type "TIME", using the MySql datareader, I get the following error:
   'MySql.Data.MySqlClient.MySqlDataReader' does not contain a definition for 'GetTime'      

I can read DateTime type, but not Time. So, how can I read the field of type TIME ?
Question by:pillmill
    LVL 50

    Expert Comment

    by:Steve Bink
    Looks like there isn't one.  There are readers for timespan, system.datetime, or mysqldatetime.

    The next seems to imply that you should be using the mysqldatetime object instead:


    Author Comment

    OK. Is there a way then, to output the results so that the output is either:
    a date(yyyy,mm,dd) OR a time (hr,min,sec) ? Thanks.
    LVL 50

    Accepted Solution

    You can use data conversion commands in the SQL.  Use CAST/CONVERT to return another data type that you want instead.


    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    In my previous two articles we discussed Binary Serialization ( and XML Serialization ( In this article we will try to know more about SOAP (Simple Object Acces…
    Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    This video discusses moving either the default database or any database to a new volume.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now