help me, this is driving me insane!

Martin

Lifer
Jan 15, 2000
29,178
1
81
I have a access db, ODBC DSN link to it and I am using PHP.

all I want to do is insert a date into a DateTime field, but nothing I've tried helps. Anybody ahve any clue? I can get the date into any format I need (date, timestamp etc), but it won't let me insert either way.
 

EmperorIQ

Platinum Member
Sep 30, 2003
2,003
0
0
Originally posted by: Martin
I have a access db, ODBC DSN link to it and I am using PHP.

all I want to do is insert a date into a DateTime field, but nothing I've tried helps. Anybody ahve any clue? I can get the date into any format I need (date, timestamp etc), but it won't let me insert either way.

are permissions set correctly? Can you read from the table? Can you write to other things besides date time?
 

Martin

Lifer
Jan 15, 2000
29,178
1
81
Originally posted by: EmperorIQ
Originally posted by: Martin
I have a access db, ODBC DSN link to it and I am using PHP.

all I want to do is insert a date into a DateTime field, but nothing I've tried helps. Anybody ahve any clue? I can get the date into any format I need (date, timestamp etc), but it won't let me insert either way.

are permissions set correctly? Can you read from the table? Can you write to other things besides date time?

yeah, I can insert othr values fine (in this case doubles). I really hate access :

<-- likes his SQL server at work.
 

Martin

Lifer
Jan 15, 2000
29,178
1
81
INSERT INTO data (timestamp, bid, ask) VALUES ('2005/06/01 4:32:01 AM', 1.2317, 1.2319)

timestamp being datetime, other two beign number (double)

if I take off timestamp, it can insert the others fine enough.
 

bunker

Lifer
Apr 23, 2001
10,572
0
71
From an Experts Exchange post: (god I hate that site...damn subscriptions!)

I believe format for inserting into a DATETIME field is:

4/1/2001 3:00:00

or, others have used this format:

1962-05-20 10:32:16

Someone was asking the same question you are. Put it in single quotes. It worked for this guy.
 

Martin

Lifer
Jan 15, 2000
29,178
1
81
i tried a bunch of different formats, with and without AM/PM, but none worked.

I've been googlingk but I can't find a single example of insert into ODBC using a date.
 

GeekDrew

Diamond Member
Jun 7, 2000
9,099
19
81
I can't recall exactly what the situation was - but I know that there was an incompatibility between PHP, ODBC, and Access in relationship to timestamping. I haven't had to research the problem in years... but for some reason it occurs to me that I used some alternate method in the end.
 

FP

Diamond Member
Feb 24, 2005
4,568
0
0
i am an oracle guy but do you need to convert the date/time string into a timestamp format first using a function?

 

Martin

Lifer
Jan 15, 2000
29,178
1
81
Originally posted by: bunker
From an Experts Exchange post: (god I hate that site...damn subscriptions!)

I believe format for inserting into a DATETIME field is:

4/1/2001 3:00:00

or, others have used this format:

1962-05-20 10:32:16

Someone was asking the same question you are. Put it in single quotes. It worked for this guy.


neither of those works. ether in PHP or access itself. i hate access.
 

Martin

Lifer
Jan 15, 2000
29,178
1
81
well, I got it. I outputed to a CSV file using the 1962-05-20 10:32:16 format. then imported into Access.

but I lost 40 minutes of my life to that stupid piece of ****** program :\
 

TekniDude

Member
Mar 8, 2004
29
0
0
timestamp might be a reserved word in msaccess, try [timestamp] instead
i HATE msaccess, the small errors like this never give you any information about what went wrong

INSERT INTO data ([timestamp], bid, ask) VALUES ('2005/06/01 4:32:01 AM', 1.2317, 1.2319)