Page 1 of 1
I can't see my dates in MySQL. Need some help.
Posted: Sun Nov 24, 2002 6:47 pm
by Genteel Beaux
I have my table set up so that it automatically enters the date and time in a field. At first, it was working fine. I could see the dates and the times. Now, all of the dates and times in each of the records are set back to the default. I don't know if I did anything. No matter what, all I get is 00000000000000 for timestamps and 0000-00-00 00:00:00 for data/time. Does anyone know what causes this?
Posted: Mon Nov 25, 2002 2:51 am
by twigletmac
Have you checked to see what the dates and times look like before you put them into the database, MySQL will just put a default value into the field if the data is not formatted correctly. Has all the previous data also been affected? If so do you run any UPDATE SQL statements to alter dates and times that don't use the WHERE clause and thus affect all records.
Mac
Posted: Mon Nov 25, 2002 7:04 am
by Genteel Beaux
I don't have any code referencing the timestamp at all. I did that so I wouldn't have to worry about doing it in the code. I'm just using an INSERT() statement to add a new record. At first, everything was working fine. Then eventually, all my previous records (timestamps) have changed back to the default values. I don't have an UPDATE() statement at all. Now, it doesn't matter when I add a new record. It is always 000000000000 or 0000-00-00 00:00:00.
Posted: Mon Nov 25, 2002 4:46 pm
by Genteel Beaux
Nevermind, I decided to go ahead and use the NOW() function in the SQL statement. I shouldn't have to relie on the SQL statement to do this, but now it works.