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 get IP address?
hey guys,

i have this code which is supposed to get me the IP address of my site visitors:

Advice on how to delete a mysql row using my form
Hi,

I am very new to php and am struggling to work out how to delete a portfolio item (a row

Log $_POST
How would i log submits on a form, by everyone? I want to then echo the number of submissions.

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

Code: public static function generateEmbedCode($

j1inmis Ouput layout changes
Hi,

Can anybody tell how can j1inmis output layout can be changed so that vendor names ge

PHP Redirecting
Hello everyone. Is there a way to redirect people to pages within a statement in PHP? Since there is

Need help-Error istream header declaration
Hi Everyone ,

I am having issue with istream declaration. I am new to C programming.
can a

How to change www in url with a specified name
Hi
I'm trying to change the url http://www.sitename.com/apparels to something like below
http:

Adding post count
How would I make it so everytime someone clicks submit on my form, their row in the database for the

Receive Rosettanet Message to SAP 4.6c
Dear all ,

My customer will send the PO details by rosettanet message , Is it

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