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

random generation
hi

i need help with generating this

numbers from 1-12

i want to generate in ran

how to put the 0-100 numbers into 1.txt and 100-200 into 2.txt ?
how to put the 0-100 numbers into 1.txt and 100-200 into 2.txt and so on 200-300 into file 3.txt ?

GET vs SUBMIT Button to show sections on one index.php page?
Just curious if one of these ways is better (i.e. more efficient) than the other.

I have a

Putting double spaces instead of single spaces
Im looking at trying to replace all single spacing between fields with double spacing

At pres

help with this code please?
Hello,

I am trying to build a remote upload script for my image hosting site.

I am usi

Best PHP Documentation generator
Hello guys!

I would like to hear from you what is the best PHP documentation generator. Perso

How to know if online site made with PHP
Hello,
I see some sites that does not display extensions at all , for example:

www.site.co

Multiple Dropdown Selections
I have a form that let's a user insert a page with the ability to select categories. I want them to

HTML Email rec'd as Source Code
The code does create and send the email successfully. However, the message shows as html code and n

Session
I am having a little trouble with a session. Not sure if it is my browser or what. I know I do not

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