tags:

views:

123

answers:

1

I am using the MySQL C API within a C++ application. I have a column in my result set that is of the type MYSQL_TIME (part of mysql.h).

Is there a way to convert MYSQL_TIME to a char* or to a C++ string?

+1  A: 

I figured it out:

fprintf(stdout, " %04d-%02d-%02d %02d:%02d:%02d (%ld)\n",
                 ts.year, ts.month, ts.day,
                 ts.hour, ts.minute, ts.second,
                 length[3]);

where length[3] contains the length of ts.

Clayton