Mysql Datetime, Remove Seconds
I've been attempting to do this for quite sometime. I have a program which periodically writes rows to a table. (table1) ID Date Text Number The Date column is in format yyyy-
Solution 1:
This is just a matter of updating the corresponding column.
Depending on ... hum ... your mood (?) you might try:
update tbl set datetime_column = substr(datetime_column, 1, 16);
Or
update tbl set datetime_column = date_format(datetime_column, '%Y-%m-%d %H:%i:00');
Or
update tbl set datetime_column = datetime_column -second(datetime_column);
Solution 2:
MySQL? try this:
SELECT DATE_SUB(datetime_column,
INTERVALEXTRACT(SECOND_MICROSECOND FROM datetime_column)
SECOND_MICROSECOND) as no_second_datetime
FROM table_name;
Post a Comment for "Mysql Datetime, Remove Seconds"