can’t believe i haven’t come across this issue before but i am trying to upload an excel spreadsheet with a column that contains dates and also other text.
the date is in the format 08/09/2011 but when i load it into mysql it changes it to some decimal format e.g. 40804 ???
how can i just upload it as is, without it changing? or is there a bit of php i can run to turn the number back into a date?
I wouldn’t normally mix dates and text but this table already exists and i haven’t got time to change 700+ records manually. Its a varchar column but i have tried Text as well with no luck. I can’t use a Date column as the text will cause a problem.
I even tried tricking excel by adding a word before the date in a new column but even in excel it changed it to the stupid decimal date.
What can i do i’m really stuck on this one!!!
any help would be most appreciated. not even sure what to search for.
hi thanks.
finally got something vaguely acceptable date by setting the cell type to text.
But OMG it is the most infuriating thing ever. excel just seems hell bent on doing what it wants and thinking it knows best.
I’m now trying to do the time column where people have entered things like 9.30 for 09:30:00 excel removes the last 0 when i upload so i get 9.3 ??? not very useful.
I’ve tried pretty much all of the cell types and its still refusing to keep the .00’s
The Text type promises to keep the text as it is typed in but when it changes it from numerical it handily removes the 0’s. very useful excel! if i wanted to remove the 0’s i would change the decimal places!!!
aaaahhh. sorry for the rant! i’ve spent all morning on what i was thinking was an hours work if that.
I’m thinking of doing a nasty work around and using php to add the 0’s back on when they are displayed on the page. thankfully its just an events listing thats needed for a couple of weeks otherwise i’d build it properly from scratch with a proper date and time field.
if you’re loading 9.30 into a numeric column, no wonder you aren’t seeing the trailing zero
my advice is to load your data into a “landing” table, and then run an INSERT SELECT statement to copy the data into its final destination table, applying conversion expressions as required