DateObject and Nulls


Posted on 16th Feb 2014 07:03 pm by admin

Hi all,

I have an array mapped to a value object. One of the items in the array is a PHP DateObject, and I need to format this field appropriately.

Did you know?Explore Trending and Topic pages for more stories like this.
When looping through the array, I pass this field to a function as follows: (simplified for expendiency)
Code: [Select]if (!is_null($date))
{
return date_format($date, "Y-m-d");
}
This works great, except for the case when the DateObject contains a null value - in this case the above function seems to always return the current date.

I am guessing that this is because $date is not really null (i.e. it contains an object, even though the object is null), but I am not sure how to get around this.

Any help greatly appreciated.
No comments posted yet

Your Answer:

Login to answer
70 Like 7 Dislike
Previous forums Next forums
Other forums

How to show the difference between two data field in a database with php.
Hello php gurus,

how r u all... i'm not so well facing a typical problem please help me...<

Operator precedence assistance.
I did a quick Google search and couldn't quite find the answer I wanted in terms I could understand,

Getting a variable to work in function params
I have this fuction which is inside a class:

Code: public static function generateEmbedCode($

How to use php and sql to check if values match the ones in a table (for logins)
How would I code it that the script takes two variables that are passed to it (UserID and PIN), and

The IE or FF detector
Hello Friends,

Problem of today ( we seek for php help ) as following ,

we know all th

An odd assignment statement. Can someone explain this assignment to me?
What purpose is served by the bit of code between the two equal signs in the $installurl set? Is th

PHP Form to Variable.
Hi! I have written a HTML-form code in DreamWeaver CS3 (in a PHP doc) and I really need it to work s

ORA-01017: invalid username/password; logon denied
Dear All,

I am facing problem in taken backup from db13 it comes up with the following l

Kill a process
I have a question - how can I kill a process from a command line or by using Oracle SQL Developer? I

I need to increse 6hours more, and i don't know how???
I need to increse 6hours more, and i don't know how???
<tr>
<t

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash