How to offset dates in a MySQL database by 1 second? How to offset dates in a MySQL database by 1 second? wordpress wordpress

How to offset dates in a MySQL database by 1 second?


You could set them all to be 'now' + id.

It might look like;

 UPDATE  wp_posts SET     createdDate = DATE_ADD(now(), INTERVAL wp_posts.wp_id SECOND);


Before you mess with this, I suggest that you make sure that in fact have a problem with simultaneous times.

I quite often find that messing with the data like this has unintended consequences. And I'd be moderately surprised if the problem really is significant.

It appears to me that I'm seeing proposals that will set all the rows to the same offset value.

Assuming you have an integer surrogate key, and the rows are adjacent, you could use

UPDATE table
SET mydate = DATE_ADD(my_date, INTERVAL id - SECOND)
WHERE id BETWEEN AND ;


UPDATE table SET mydate = DATE_ADD(my_date, INTERVAL 1 SECOND);