NOTE: The following instructions are no longer needed as the Date module's 'Date Tools' sub-module can be used to import dates from the Event module.
You have two solutions "Import with Ical and FeedApi" or "Import the data in the new field".
Import with Ical and FeedApi
Here is a simple solution for moving your events from the Event Module to the Calendar Module. This proccess involves two major steps.
1) Setting up a url for an Ical feed from the Event Module that will export all your events
2) Importing the ICal feed using FeedApi, FeedApi Mapper and iCal parser to new/or same content types with event times now being stored in CCK Date Fields.
Step 1 - Export
An Ical feed of all your Events can be created using the URL
http://www.example.com/event/YYYY/MM/DD/ical/all/all/DURATION
Where YYYY/MM/DD is the beginning date
and DURATION is the number of days after the beginning date to include
e.g. http://www.example.com/event/2009/07/09/ical/all/all/100/ will provide an Ical feed for events starting on 9th July 2009 and including next 100 days
You can check if all the events you want are included at the URL below (same format as above)
http://www.example.com/event/YYYY/MM/DD/list/all/all/DURATION
Step 2 - Import
Once you are satisfied with the URL for your Ical feed you can now import this Feed to CCK Date fields following the instructions at http://drupal.org/node/341716
If you have no need for FeedApi anymore you can then uninstall it afterwards
This solution will only allow you to move the title, description and date information of your events however, if there are any extra fields they will not be moved over
Import the data in the new field
This is the other solutions originally by http://pingvision.com.
While there are undoubtedly other approaches to achieve this end, this is a relatively quick and painless path to get the features you want up and running.
You'll require the following D6 supporting modules:
CCK - http://drupal.org/project/cck
Date - http://drupal.org/project/date
Views - http://drupal.org/project/views
Calendar - http://drupal.org/project/calendar
Install and enable the latest revisions of these modules.
Identify the content type or types currently on your site which are used by events. The process differs slightly depending on whether the resulting CCK date fields will be located in only one content type, or shared between multiple types.
Through the CCK interface, create new date fields in your existing event content type. These are the fields into which the old event information will be migrated . For the purposes of this document, I'll call them "eventstart" and "eventend".
If you have only one content type for events, your new fields will be created in the mysql table corresponding to that type. For example, if your content type was called wine_tastings, a table called content_type_wine_tastings will exist in your database, and the fields field_eventstart_value and field_eventend_value will exist in this table.
If you're sharing the eventstart and eventend fields between multiple content types, new tables will be created to house this data. In this example, the tables would be called content_field_eventstart and content_field_eventend.
Now with a little php and mysql magic, we can populate the new field data from the event_start and event_end fields from the original event table. Because the date information is stored in slightly different formats, a little bit of transformation is required. Create a php script like the example below, and execute from the command line.
This example was constructed using shared date fields across multiple content types.
Remember to back up your database before performing any operations like this!
// You backed up your database, right?
// Set up the mysql connection
// Drupal's bootstrap function may be substituted here
require_once '/path/to/drupal/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$con = mysql_connect('localhost', 'yourdbusername', 'yourdbpassword');
mysql_select_db('yourdbname', $con);
// Cycle through all the records in the event table
$q = 'select * from event';
$r = mysql_query($q);
while ($row = mysql_fetch_assoc($r)) {
// Transform the date information
// CCK date format: 2008-12-10T00:00:00
// event date format: 2006-11-13 15:00:00
$startdate = preg_replace("/ /", 'T', $row['event_start']);
// Populate the new field for eventstart
$q2 = 'update content_field_eventstart set field_eventstart_value="' . $startdate . '" WHERE nid="' . $row['nid'] . '"';
if (!$r2 = mysql_query($q2)) {
// Don't continue if anything goes south
exit($q2 . " failed!\n");
}
// Perform the same transformation and data population for the end date
$enddate = preg_replace("/ /", 'T', $row['event_end']);
$q3 = 'update content_field_eventend set field_eventend_value="' . $enddate . '" WHERE nid="' . $row['nid'] . '"';
// Once again, terminate the operation if the query fails
if (!$r3 = mysql_query($q3)) {
exit($q3 . " failed!\n");
}
}
Once you've got these fields populated, you should check an existing node to verify that the information has been correctly populated. Navigate to one of your event nodes, and select edit. You should see both the legacy event date information and the new CCK fields populated with the start and end dates.
If this all checks out, browse to the modules page and disable the events module. You are now free to uninstall the event module and purge any vestigial tables.
Congratulations! You have converted your event nodes to a more flexible CCK/Date setup. These fields are now available for use in views using the calendar module!
Comments
For the "Import the data in
For the "Import the data in the new field" version, there was some additional date conversion coming from D5. In D5 the event dates aren't formatted as "2006-11-13 15:00:00", they are timestamps.
so just replace the 2 lines...
Edit:
Actually, having a separate "eventend" field doesn't make sense if you're using date repeat, so just add a From date to the "eventstart" field (So eventstart will have a from and a to date) - you can delete "eventend". Then use the modified script below...
-----------------------------------------------------
Bob @ Drupal Aid (https://www.drupalaid.com)
Just installed the date
Just installed the date module - its tools do not seem to have any way to import d6 events to d7. Did'nt I try hard enough or the statement at the top of this page is wrong?