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

Help with some dates
I have a list of dates in an array:

$mondays = array(
strtotime("October 12, 2009

Cursor statement failed with errors
Following statement failed with the errors.

cursor proj_cursor1 is (select projectID from

ORA-00932: inconsistent datatypes: expected - got CLOB
SO : windows xp
database : XE

there is a table (transito) with two fields of clob

Strange cookie problem. setcookie dependant on where user was directed from?
Hello,

I have a website that sets a cookie when a user visits the website. The cookie holds a

need to add "sizes" to shopping cart
Hey guys, I am trying to figure out a way to add a "size" selector on to this bit of code.

Guixt issue
Hello all,

We are experiencing the following problem with Guixt:

Some transact

ALV sum various columns problem
Hi all,
I'm doing a report on ABAP for a timesheet of the current month. The output i want is s

Significance of BPM
Hi Experts,
I am a novice in BPM , I just want to know how BPM as permenant department is

PHP Script runs on CLI but not through web browser
I am running into an issue that I just can't seem to find the answer to. I have a Windows Server 200

mails going in spam??
The mails I sent to folks in my database using mail(function) are going in spam??

Any idea ho

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