I have this code:
//test the date functions without screwing anything else up
$start = date_now();
$timezone = date_default_timezone_name();
drupal_set_message('
Start: ' .print_r($start, TRUE). '
');
drupal_set_message('
Timezone: ' .print_r($timezone, TRUE). '
');
drupal_set_message('
Date make date: ' .print_r(date_make_date($start, date_default_timezone_name()), TRUE). '
');
I get empty arrays showing for the first and third messages, but the timezone one is fine. I added the timezone one because I thought that maybe the API file wasn't getting loaded or something. I do have PHP5.2.6.
Any idea what the problem could be? What other information could I provide to help figure this out?
Standard answers:
-No, I'm not up to date with my Drupal installation, still several security updates behind.
-Server is Apache 2.2.8 on WindowsXP.
-The PHP date() function works fine given any formatting.
-All date modules are installed except the PHP4 one.
-I'm not including the date_api.module directly in my module, but I didn't think I had to. I only included it in my .info file.
-Yes, I looked through the queue for a similar post but didn't see anything in the latest 100+ posts.
Thanks in advance for the help. This is the last part of a large project, so I'd love to get this finished up.
Comments
Comment #1
karens commentedIt's not an empty array, it's a PHP 5 date object. There's no way to see what's in it using print_r(), that's the way PHP5 created it. You have to do things like the following to see what's in the object:
Both date_now() and date_make_date() create those date objects, and the Calendar module code creates date objects for the items in its calendar.
The nice thing about them is that they are totally manipulatable. You can do things like this:
Comment #2
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.