Hello,
In snippet #1 I initialized a placeholder
DOB (date of birth) with a date value from the database.
$modx->setPlaceholder('DOB', $result['DOB']);
In snippet #2 I’m trying to explode the value of this placeholder:
$dob = '[+DOB+]';
list($year, $month, $day) = explode('-', $dob);
$year = $dob[0];
$month = $dob[1];
$day = $dob[2];
// I also tried: list($year, $month, $day) = split('[/.-]', $dob);
The results are:
echo ’[+DOB+]’ -> 1982-12-02
echo $dob -> 1982-12-02
echo $year -> 1982-12-02
echo $month -> blank
echo $day -> blank
Everything works as expected when I substitute the date value from the database with a constant "1982-12-02"
I’ve also tried many variations of date manipulation (of either the original DB query or the placeholder) via PHP’s
date() function - such as in:
$year = date(’Y’, $dob), but each time I use
date(), the error message below is received. I’ve looked at MODx docs and wiki for solutions but couldn’t make head from tail.
MODx encountered the following error while attempting to parse the requested resource:
« Execution of a query to the database failed - Incorrect integer value: \'\' for column \'user\' at row 1 »
SQL: INSERT INTO `celebrities`.`modx_event_log` (eventid,type,createdon,source,description,user) VALUES(1,3,1235644591,\'love-horoscope - Snippet\',\'date() [function.date]: It is not safe to rely on the system\\\'s timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected \\\'Europe/Helsinki\\\' for \\\'2.0/no DST\\\' instead
Please help me to figure out what I am missing here.
Thanks a lot.