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

iMatch stored value with the current value in a loop
Hello,

I have a MySQL db were I store articles in.

I have a form to fill these article

A problem with my GD class
Hello,

I created a nice (and simple for now) GD class.
The problem is , it works great on

Forms Authentication and Refresh at Login page
Hello, When I try to press the Login button in my webapplication at my login.aspx page nothing h

PHP page is blank
Hi Everyone,

I have a site in which I am able to open the first PHP webpage in my browser but

php calculate
this code echoes correctly the sum but the inserted result is 0??
Code: <?php
$TotalNum

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 ?

Effort Estimation Template for Steady State Support
Hi Everyone,

Is there any SAP provided template/format for system change and enhancements

PHP Thumbnail Creation
Ok so i use this function to create thumbnails:

Code: function createthumb($name,$filename,$n

simplexml_load_file and rss problem
Hi,

I have a problem parsing an rss feed using simplexml_load_file - this is strange as i hav

whats wrong with my code please help!!!
this is the error


Warning: mysql_close(): supplied argument is not a valid MySQL-Link res

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