views:

222

answers:

1

I added some users from an excel via a script to my drupal database. This works fine except for one thing, i use the profile module to store some information, one of them is the date of birth.

In my excel the date is stored like '18/02/1995' but in the database a date field has a format like this 'a:3:{s:5:"month";s:1:"2";s:3:"day";s:2:"18";s:4:"year";s:4:"1995";}' Of course the date's all come out the wrong way in drupal. So i have to convert my date's to drupal date's.

So i would like to know what kind of format this is and is there a function to convert my date's to this format?

(if it is in any way possible to do this in sql or excel that would even be more excellent)

+2  A: 

You can use serialize:

serialize(array('month' => '2', 'day' => '18', 'year' => '1995'));

It will output:

a:3:{s:5:"month";s:1:"2";s:3:"day";s:2:"18";s:4:"year";s:4:"1995";}
dusan