Jump to content

Time help please


topflight

Recommended Posts

Hello I have some columns where the time format is incorrect lets say that the time is 17:30 will in the database it will show 1730 or another example lets say that the time was suppose to be 6:30 instead it is 630. I would go in and edit each one of them except their is 15,000 rows, so may someone please tell me on how I can fix this problem thanks.

Link to comment
Share on other sites

I would personally run 2 UPDATE queries. The first one to add a '0' in front of all values where the time is between 1:00 and 9:59. Then create a timestamp column and use MySQL UPDATE with LEFT() and RIGHT() to get the value and enter it into the new timestamp column.

Link to comment
Share on other sites

Well, you may need to change the type in your database if the column isn't of a string type.

 

I'm not going to write any example code. They're just 2 simple UPDATE queries. It's really not hard. Try it out and if you have troubles, then I'll consider it. Look up the functions I mentioned. There are examples on the MySQL site if you don't know how to use them.

Link to comment
Share on other sites

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.