Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Entering dates in mysql table

Status
Not open for further replies.
Jul 28, 2005
358
FR
I have a php script that allows dates to be entered and then stored in a mysql table along with other info. I allow the user to enter the date in British format (ie 12/11/2005 for 12th December 2005). I then explode it with php and put it back together so it fits the format of the mysql date functions.

The problem I have is strange though. On my development server everything goes great and dates anre entered into the database no problem (and read afterwards when needed). However on my client's server all the dates are entered into the database as 000-00-00 instead of 2005-12-11.

Has anyone got any idea why this should be so? I know the the script is passing the correct data over (and the scripts are obviously identical anyway on the two servers).

If needed I can post the code, but it just inserts the data into the relevant table using standard mysql commands.

Thanks

Richard

 
Are you sure you're manipulating with the data you are expecting? Have you echoed out the insert sentence and inspect it if it does look what you expect? Posting some code would help, yes.
 
Thanks Vragabond,

Yes I am certainly manipulating with the data I expected. As I said it works fine on my development server just not on the clients.

Anyway, I took the - seperator from the date string and mysql accepts it now. It seems that it was treating it as an invalid date string.

Thanks anyway.

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top