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

Need help with basic sql
Hi,

I am using oracle 10g, and having some small doubts related to sql , here goes the si

insert Multiple rows into the table from that table data
Hi All,

I have a requirement like to insert mulitple rows into the table from that

MFC GUI Programming
I am working on a project right now that requires me to create a MFC Windows GUI. Basically it need

Pipe email to PHP - get mail adress from MySQL - send?
Hi all,

this is the challenge:

1) Our faculty at the college where I'm employed includ

get multiple rows
Hi I want to get multiple rows from a db

I am using this for the db query
Code: public

PHP friend keyword equivalent
is there a PHP equivalent for the C++ friend keyword?

small inaccuracies
I have this code to convert fractional base 10 into base 2:

while($num > 0)

Comparing two dates
Hi Guys
I have two dates I want to compare. Below is my current implementation. The problem with

Count
Getting the same count everytime

Code:
$visitquery = mysql_query("SELECT COUNT(*) FR

How to implement HTTP connection timeout
Hi All,I would like to implement an HTTP connection timeout.

I am working on a application wh

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