Hi,
I'm not sure if this is a duplicate or not, but i couldnt find anything in the queues to exactly what i was experiencing straight away, sorry if it is.
when i try calling date_make_date() to generate a date object it returns an empty object.
i have tried multiple formats as following -
$date = date_make_date('2009-07-09 12:18:06', null, DATE_DATETIME);
$date = date_make_date('2009-07-09T12:18:06', DATE_ISO);
I have also tried with DATE_ARRAY. All these return a blank object :(
any ideas?
Comments
Comment #1
buddaPassing in an array for $date and a type of DATE_ARRAY would return a NULL according to the code:
Comment #2
karens commentedIt's not 'an empty object', that's the way the PHP date object works. You can't see anything in it, but it is valid. You can do things like:
And you will see that it holds a value.
Comment #3
cyberwolf commentedHi there
I'm encountering the same issue.
Passing in $date as an array, and setting the $type to DATE_ARRAY:
$date_object is NULL now because of the line mentioned by budda.
Removing the is_array() check seems to solve the problem here.
Comment #4
cyberwolf commentedI suggest just removing the is_array check, I don't see what's the use of it.
Comment #5
cyberwolf commentedA temporary workaround is using date_convert() instead of date_make_date().
Comment #6
netsensei commentedI just noticed the same thing.
Trying to get this to work:
$date = date_make_date('1995-10-09T00:00', NULL, DATE_ISO);returns me an empty object. I've also tried it with DATE_DATETIME. No dice.
Comment #7
damienmckennaUnfortunately the D6 version of this module is no longer supported, but we appreciate the time you put into this. If this problem is relevant for D7 too, please reopen the issue. Thanks.