PDA

View Full Version : Why is user.joindate an 'int' field?


telc
09-27-2002, 08:52 PM
I am trying to format the sql but I can't because joindate, is a 'int' field

mysql> select DATE_FORMAT(joindate, '%m.%d.%Y') AS joindate from user limit 0,1;
+----------+
| joindate |
+----------+
| NULL |

Why would the unix timestamp be stored in a 'int' field?

Xenon
09-28-2002, 09:32 AM
the unix timestamp is the ammount of seconds that have been since 1.1.1970, thats why it's saved as an int-val.

Scott MacVicar
09-28-2002, 09:36 AM
because its too long to be a smallint field and a timestamp is always an integer since its seconds since the epoch.

telc
09-28-2002, 03:04 PM
Why not store it in a 'TIMESTAMP' field? Do you know any way I can use date_format on it, since its not in a 'TIMESTAMP' field.

NTLDR
09-28-2002, 05:42 PM
Use the vbdate function:

$user[joindate] = vbdate($dateformat,$user[joindate]);