A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2009 yearHow to offset dates in a MySQL database by 1 second? - page 1
User InfoPosts
How to offset dates in a MySQL database by 1 second?#1
I(ve imported a bunch of posts into a Wordpress site that all have the exact same date. I(d like to edit the post dates so they are offset by one second.

My concern is that there may be a performance issue when all of the dates are the same.

Anyone know quick way to get this done using phpMyAdmin to edit the MySQL database or some other method?

posted date: 2009-04-14 06:45:00


Re: How to offset dates in a MySQL database by 1 second?#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2009-04-14 06:45:01


Re: How to offset dates in a MySQL database by 1 second?#3
UPDATE table SET mydate = DATE_ADD(my_date, INTERVAL 1 SECOND);

posted date: 2009-04-14 06:48:00


Re: How to offset dates in a MySQL database by 1 second?#4
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);

posted date: 2009-04-14 06:49:00


Re: How to offset dates in a MySQL database by 1 second?#5
SET @r := (2009-04-14(;UPDATE mytableSET mydate = (@r := @r + INTERVAL 1 SECOND);Or in a single query, if your cannot keep the session state:UPDATE mytable, ( SELECT @r := (2009-04-14( ) qSET mydate = (@r := @r + INTERVAL 1 SECOND)

posted date: 2009-04-14 06:52:00


Re: How to offset dates in a MySQL database by 1 second?#6
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 useUPDATE table SET mydate = DATE_ADD(my_date, INTERVAL id - SECOND) WHERE id BETWEEN AND ;

posted date: 2009-04-14 06:58:00


select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.