Jump to content

Recommended Posts

i have a backup of the DB but wanted to find a quicker way as there are 1000's of entries. and removing them and reverting back to previous would be annoying if i kept having to do it until it was right.

 

once it is correct i would remove the old field.

the site has been completely redone and it now stores the date and time in this format so to make things easy i wanted to keep the same format throughout, and all the other entries that i have copied over from the old database had the old formated date/time so now none of these entries show up on the site at all because of it.

 

all i want to do is convert them and remove the old formated date field once done.

I hope your mysql timezone is set correctly and that your mysql timezone/DST database is up to date or you will mess up all your data. I also hope you don't have any dates older than 1970 or plan to use dates later than 2038, because the mysql Unix Timestamp storage and the mysql conversion functions currently only work for that range of years.

 

You took a huge step backwards by going from dates stored as fixed human readable values (i.e. a date/time stored as 2012-01-07 08:39:00 will always be that value) to Unix Timestamps, which are dependent on a relatively slow and ambiguous conversion. Converting a Unix Timestamp to its human readable value is dependent on the timezone setting and any DST offset and is affected by how up to date the timezone/DST database is - mysql and php each have their own timezone/DST database that must be kept up to date as locations have been redefining their DST start/stop dates.

 

Using Unix Timestamps for your data storage also means that you cannot use any day/month/year grouping directly in any queries, so you must execute more/slower queries to manipulate data that is associated with any human readable day/month/year divisions.

It isn't going to matter, I suspect. It sounds like his mind is made up. It's going to be a giant headache in the future just to avoid editing the scripts and doing it the right way now.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.