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

Oracle Connectivity
Hi Every One,

Can we access SAP from oracle database.If it possible then please spec

Most basic form question ever?
Hello,

I want to use this snippet to make sure the fields in a form are ok before processing

Displaying values from a SQL count...
Hi,
Easy enough question i just forget the exact method ..
I have ...

Code: //count win

update post issues
I am trying to create an update to a post function, while the update does occur, the page routing an

Share admin accross websites
I'm using .net memberships and roles in one of my sites, but I need to be able to share logins and p

type check while uploading
Hi Everyone,

How can I check the exact type of a file while uploading on my site?

Here

Problem with passing variables
I'm not really a php programmer so I'm really struggling with this issue.

I have a banner s

confused between ' ' and " "
there is a php i set:
$begin_date_query = mysql_query( "SELECT SUBDATE(due_date, INTERVAL $d

php title problem
Hi,

I am having a problem managing my page title with PHP.

Currently I have my <

email CODING Problem
Email coding problem.

I need to send a section of the info to $tf and the same as a Cc to $em

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