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

Why Are These Functions Causing MASSIVE Memory Problems? Please Help!
Hi,

I have a script with some options.

I use regex to replace patterns in strings, but

no idea what to do...
I'm fed up. I had issues with code that I have working on a different site that didn't work on my cu

Creating XML with php
I need to creat an XML with php and have successfully produced a valid output.
The problem I hav

Select question
Hi,

First I would like to say that php is pretty new for me..
so please don't shoot me if

php email checker
I am having alot of trouble finding info on how to do these email things. I need to do the following

problem with refreshing
in my site, i have an index page, it has a main div. this main div's content is changing according t

login page does not execute a else statement
I've created a login page using sessions.
When an incorrect user name or password is entered then

Select all entries from database that include a phrase
I have a database of clubs - one of the categories is meeting time and place
I would like to have

mail() problem
Hi Guys,

I've set up a contact email form. It sends the information fine, but it sends it to

Oracle Text CTX_DOC.snippet slow
I have a table (FILE_TABLE) that contains a blob column (ft_file) and I have created the following O

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