[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-odbc
Subject:    Re: Anyone know the c syntax for
From:       Nick Gorham <nick () lurcher ! org>
Date:       2002-01-04 23:14:59
[Download RAW message or body]



"Devore, Jacob" wrote:

> getting a datetime from the sql server?  ODBC says the type is 11, which is
> defined in the odbc header files, and the size is 19 bytes.  When I try to
> fill out the data it puts garbage in the there.

Well, it should be one of these if you get it as a SQL_TIMESTAMP

typedef struct tagTIMESTAMP_STRUCT
{
        SQLSMALLINT    year;
        SQLUSMALLINT   month;
        SQLUSMALLINT   day;
        SQLUSMALLINT   hour;
        SQLUSMALLINT   minute;
        SQLUSMALLINT   second;
        SQLUINTEGER    fraction;
} TIMESTAMP_STRUCT;

But if its length 19, I suspect you are getting it as a string, If you still
want it as a string, its probably

yyyy-mm-dd hh:mm:ss.ffffffff

with the seconds optional, 19 would be just the date and time.

SQL_TIMESTAMP may well be easyier than a string YMMV.

Nick Gorham


---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail myodbc-thread4469@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail myodbc-unsubscribe@lists.mysql.com instead.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic