problem to insert data

From: os2 (marcpirat_at_yahoo.com)
Date: 11/25/04


Date: 25 Nov 2004 08:12:37 -0800

hi

i have an insertion problem with my rtu table
datatype for date1 field is: datetime

i try to insert local date to the database (mysql)

source code

struct tm *date;
struct timeval begin;
struct timeval end;

gettimeofday(&end, NULL);
date = localtime(&end.tv_sec);
strftime(datestr, 128, "%F %T", date);
printf("date str %s", datestr);
snprintf(query, 512, "INSERT INTO rtu (date1,duration,sensorid)
VALUES(%s,%d,%d)",datestr, 0, 0);
res=mysql_query(&my_connection,query);

res display 1 (a error)

datestr display me
2004-11-25 15:52:55

query variable return
INSERT INTO rtu (date1,duration,sensorid) VALUES(2004-11-25
15:56:11,0,0)

any idea?