in reply to formatting mysql timestamp
---------------
From http://www.mysqlfreaks.com/statements/68.php.
UNIX_TIMESTAMP:
Statement Info:
If called with no argument, returns a Unix timestamp (seconds since '1970-01-01 00:00:00' GMT) as an unsigned integer. If UNIX_TIMESTAMP() is called with a date argument, it returns the value of the argument as seconds since '1970-01-01 00:00:00' GMT. date may be a DATE string, a DATETIME string, a TIMESTAMP, or a number in the format YYMMDD or YYYYMMDD in local time.
Examples:
SELECT UNIX_TIMESTAMP();
-> 882226357
SELECT UNIX_TIMESTAMP('1997-10-04 22:23:00');
-> 875996580
So, you should be able to do something like UNIX_TIMESTAMP(fieldname) and have it convert for you. Why go through all the bother of doing it yourself?
|
|---|