Changing a field from DATETIME to TIMESTAMP
Posted: Sat Mar 28, 2009 2:51 pm
I'm trying to change one of my fields in my table from a DATETIME type to a TIMESTAMP type. But for some stupid reason the data in the field is still in the format 0000-00-00 00:00:00. Unless it's just displayed that way in phpMyAdmin... (This is the point in writing this post whrere I go and tests things out with php) After I tested things out I came to the conclusion that it's not just phpMyAdmin; the data stored in the date field is still in the unwanted format.
So I tried creating a new field all together, and still the same results.
Why must changing a MySQL table's fields be so damn confusing?!
I just want a date field that's in timestamp format, that is, an integer. Why do I want this? Because I have to convert the DATETIME into a timestamp in order to use the php date() function anyway.
So why when I change my date field to a TIMESTAMP or create an entirely new field with a TIMESTAMP type the data in the fields are still in that <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span> format!? Stressful...
How could I change my date field to a TIMESTAMP integer?
Thanks for reading, and hopefully your not offended by my ranting either.
[EDIT] Sense I don't see any advantages with DATETIME type and I do with TIMESTAMP, I'm trying to change the type. The advantage that TIMESTAMP has over DATETIME is that I don't have to use the strtotime() php function ever time I want to reformat a date using the date() php function. If you know of any reasons why I should stick with DATETIME, then please point them out.
So I tried creating a new field all together, and still the same results.
Why must changing a MySQL table's fields be so damn confusing?!
I just want a date field that's in timestamp format, that is, an integer. Why do I want this? Because I have to convert the DATETIME into a timestamp in order to use the php date() function anyway.
So why when I change my date field to a TIMESTAMP or create an entirely new field with a TIMESTAMP type the data in the fields are still in that <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span> format!? Stressful...
How could I change my date field to a TIMESTAMP integer?
Thanks for reading, and hopefully your not offended by my ranting either.
[EDIT] Sense I don't see any advantages with DATETIME type and I do with TIMESTAMP, I'm trying to change the type. The advantage that TIMESTAMP has over DATETIME is that I don't have to use the strtotime() php function ever time I want to reformat a date using the date() php function. If you know of any reasons why I should stick with DATETIME, then please point them out.