The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Help importing WordPress tables into vB tables?
I am working on merging/importing WordPress content into vB 4.1.8. Since the WordPress version is not one supported by Impex, I am having to import a lot of the content manually. Impex did allow me to import all of the user data and part of the WP posts data, but some of it would not transfer over.
In particular, I am attempting to copy over the WP post_date into vB dateline columns. I have noticed that the format for the dates is different. In vB, the dates look something like this "1311841061" and in WP they look like this "2011-07-14 04:35:36". Does anyone know how I can correctly convert that so it copies over in the correct format? Thanks! --------------- Added [DATE]1323235634[/DATE] at [TIME]1323235634[/TIME] --------------- Also, does anyone have any advice for me as I am doing this merge manually without Impex for the first time? I haven't been able to find any mods, instructions, or anything that do this with vB 4.x. so I am winging it. |
#2
|
|||
|
|||
I find this site to be very useful for converting dates to unix timestamps: http://www.epochconverter.com/. Hope this helps!
|
#3
|
||||
|
||||
this may be a good guide for converting the table/column to the proper time format. (in phpmyadmin or something similar)
http://stackoverflow.com/questions/1...mysql-datetime remember to backup before modifying. |
#4
|
||||
|
||||
Awesome! I will check out those links. Thanks!!
|
#5
|
||||
|
||||
After much research and trial and error, I find myself a bit frustrated. I am on the right path, but can't get the queries quite right. Any assistance would be greatly appreciated.
I know I need to convert the database field type DATETIME to UNIXTIME. I figured out how to display the whole field in UNIXTIME with the query below, but it does not permanently convert or save it. Code:
SELECT UNIX_TIMESTAMP(`post_date`) FROM `wp_posts` Code:
ALTER TABLE `wp_posts` CHANGE `post_date` `post_date_old` int(11) NOT NULL ALTER TABLE `wp_posts` ADD `post_date` UNIXTIME NOT NULL UPDATE `wp_posts` SET `post_date`=FROM_DATETIME(post_date_old) |
#6
|
|||
|
|||
Quote:
I think I would have tried something like this - what happened when you tried? |
#7
|
||||
|
||||
I get this error...
Code:
Error SQL query: ALTER TABLE `wp_posts` CHANGE `post_date` `post_date_old` int( 11 ) NOT NULL ALTER TABLE `wp_posts` ADD `post_date` UNIXTIME NOT NULL UPDATE `wp_posts` SET `post_date` = FROM_DATETIME( post_date_old ) MySQL said: #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 'ALTER TABLE `wp_posts` ADD `post_date` UNIXTIME NOT NULL UPDATE `wp_posts` SET ' at line 2 |
#8
|
|||
|
|||
Those are three separate queries, so they need to be executes separately. I think the error's saying it got confused when it reached the second query.
|
#9
|
||||
|
||||
The first line executes properly. The second line didn't work.
|
#10
|
|||
|
|||
Oh...oops, should have noticed that. I guess there is no "UNIXTIME" type, so you just want it to be int(10) .
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|