Facl & CiviCRM YYYY-MM-DD HH:MM:SS

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
stefanwray's picture

raSANTIAGO's scripts for importing data into CiviCRM from original Facil data are working very well. (See: http://groups.drupal.org/node/23535) So far, I've only had to make a few modifications to the code. Especially pleased with the scripts for pulling Facil's Class data into CiviCRM's Event tables. raSANTIAGO developed these scripts for Portland Community Media and released them as open source code available to anyone in the Public Access community involved with migrating away from Facil to an open source database environment (particularly MySQL). My initial attempts at applying them to our specific case at channelAustin proves two things: 1) they are working for us; 2) someone with limited knowledge in CiviCRM and/or SQL commands (like me) can use them. Therefore, these scripts promise to be a tool that many Public Access centers stepping away from Facil will want to use.

Having said that, there are no doubt specific issues that will arise. I'm having a problem right now with the date field. The problem became apparent to me when I was attempting to use a feature in CiviEvents to establish a date range and see which class events occurred during that date range. It was not working. In the database (using phpMyAdmin) I checked the values for dates in the column in the appropriate events table.

The format I saw for the date value was this:

YYYY-MM-DD HH:MM:SS

I checked some information on MySQL, and it says that in version 5.x and above that this is the default date format. And I checked some information on CiviCRM and it says that the format needs to be:

YYYY-MM-DD

I also learned that this function, Date (), will convert date formats. So:

Date (YYYY-MM-DD HH:MM:SS) becomes YYYY-MM-DD

I'm guessing that all I need to do is have a short SQL script that for every table row will apply the Date () function to the values in the column with date data. I searched for similar SQL scripts, but couldn't find any. So if anyone has any advice or can point me in the right direction for how to resolve this, it'd be appreciated.

Thanks.