![]() |
Unix timestamp not playing well with others
If I hadn't found this place, I don't know, but I'd probably have the manuals printed out three or four times, with sticky notes everywhere and papers piled on all my animals.
Now, that said, what the hell is going on here? PHP Code:
I can't find any sites that document this happening, so no luck in fixing it so far. The table column it's going into is an unsigned tinyint(11) which is the same as I've always used for my timestamps. What the bleep? :-/ -m |
An
UNSIGNED TINYINT column can contain a maximum value of 255. The number in parentheses is only for the display width of the column and has no effect on the range of values that can be stored in it. Since timestamps are integers like 1208895830 they are way, way out of the accepted range of values (-128–127 signed; 0–255 unsigned) and therefore they get truncated to 255.You should use an appropriate column type (either DATETIME or TIMESTAMP) to store the timestamps and use the available MySQL functions (FROM_UNIXTIME, UNIX_TIMESTAMP) to convert between the integer Unix Timestamp and other representations. |
I feel... like an idiot.
I glossed over that when I changed the table structure, I had it right the first time, and I'm not sure why I changed it to a tinyint. Oy. |
| All times are GMT. The time now is 02:36 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0