Reputation: 10208
I want to get the last second of a date in MySql 5.1. For example, my table has a column "date". I want to set another datetime column with the last second of date.
Something like:
update <TABLE>
set datetime = DATETIME(YEAR(date), MONTH(date), DAY(date), 23,59,59)
Is that possible?
Upvotes: 2
Views: 1947
Reputation: 125955
UPDATE tbl SET datetime = DATE(date) + INTERVAL 1 DAY - INTERVAL 1 SECOND
Upvotes: 5