if date/time from recordset is less than or equal current date? Is this even possible?
I have a recordset on a page and one of the fields is a datetime field from MySQL database.
I want to display some text on the page if the date from the recordset is less than the current date, and alternative text if the date is greater than the current date. I have tried what feels like a thousand combinations of solutions and eventually landed at...
<?php if (date("j F Y",strtotime($rsCONFIRMEVENT->getColumnVal("DGCRCeventEND"))) < date()) { ?>
<h6><?php
echo($rsCONFIRMEVENT->getColumnVal("DGCRCeventSTART")?date("j F Y",strtotime($rsCONFIRMEVENT->getColumnVal("DGCRCeventSTART"))):"");
?></h6>
<?php } ?>
<?php if (date("j F Y",strtotime($rsCONFIRMEVENT->getColumnVal("DGCRCeventEND"))) > date()) { ?>
<h6><?php
echo($rsCONFIRMEVENT->getColumnVal("DGCRCeventSTART")?date("j F",strtotime($rsCONFIRMEVENT->getColumnVal("DGCRCeventSTART"))):"");
?> - <?php
echo($rsCONFIRMEVENT->getColumnVal("DGCRCeventEND")?date("j F Y",strtotime($rsCONFIRMEVENT->getColumnVal("DGCRCeventEND"))):"");
?></h6>
<?php } ?>
The date from the recordset is most definitely less than the current date but it doesn't display either sections of text.
I really struggle to understand why date formats are so complicated in database setups and I think I've probably completely wrecked it by doing a strtotime.
I'd appreciate any help anyone could offer.
Thank you.
NJ