1

I had an issue where the server time wasn't set to the correct timezone and now need to update the created datetime for all users. New users from here on in will be using the correct timezone.

Essentially, I need it to run through all rows in table users and update column created with + 11 hours

I've tried this but it errors:

select `created` FROM `users` + INTERVAL 11 HOUR

1 Answer 1

1

You can use a MySQL function DATE_ADD:

UPDATE users SET created = DATE_ADD(created, INTERVAL 11 HOUR)
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks @Sithu, getting error "#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'HOURS)' at line 1"
@TFK300 Sorry, use HOUR without S.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.