Date record returns 01011970

Bren

Member
I'm trying to run a conditional if statement to compare to today; but my date element in each row (biddate) keeps returning 01011970. My biddate format is "m-d-Y l h:i:s A". All I need is the date portion to compare to today. My if statement keeps failing because of the strange 01011970. Please help. Thanks in advance.

$todaysdate = date("mdY");
$biddate = $this->_row->data->bw_projects___biddate;
$biddate = date("mdY", strtotime($biddate));
 
Are you doing this in php ?

If so it should be something like this :
PHP:
$todaysdate=date("mdY","today");
$app=JFactory::getApplication();
$biddate=$app->input->getString('bw_projects___biddate');
$biddate=date("mdY",$date);

And then try to make your condition

(please bare with me , i'm no php expert, if you found anything wrong please excuse me, hopefully you get the directions on where you are going)

Then again there may be another forum user that could help you better ...
 
Yes, thank you for your tip.
It looks like I was having issues with the format of my biddate element. So, I was finally successful with the following.

<?php
// Below creates a variable "biddate" and loads each row with the biddate field
$biddate = $this->_row->data->bw_projects___biddate;
// Below the 2 lines of code pulls from the biddate variable only what is needed to run conditional if statement later
$biddate = DateTime::createFromFormat("m-d-Y l h:i:s A", $biddate);
$biddate = date_format($biddate, 'mdY');

// Below creates a variable containing todays date
$todaysdate = date("mdY");
?>
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top