Page 1 of 1

Edit Default Value, timestamp

Posted: Thu Sep 11, 2008 11:41 pm
by kumarrana
My timestamp returns date in this format 20080823235029. I would like in CURRENT_TIMESTAMP format. I noticed that my Default value is NULL. I already have bunch of post related to that date. Can somebody give me a command to change my Default value to CURRENT_TIMESTAMP with out changing any other table values.

Re: Edit Default Value, timestamp

Posted: Fri Sep 12, 2008 2:52 am
by onion2k
Use mysql's DATE_FORMAT() function.. eg

Code: Select all

SELECT DATE_FORMAT(`table`.`timestamp_column`, "%Y-%m-%d %H:%i:%s") AS timestamp_formatted FROM `table`