I've retrieved some meta information from the database, I believe that it's a Unix time stamp, made up of 10 chars. ( eg:
1498867200 (1 Jul 2017) )
I first had some trouble as it apparently came back as a string so I'm getting it with
$rangeStart = intval(get_post_meta( $form->ID, 'start_date', true )) $rangeEnd = intval(get_post_meta( $form->ID, 'end_date', true ))
Formatting is working correctly with
date( 'j M Y', $rangeEnd )
I've then checking during my loop to see if now falls between the date range with:
if( $rangeStart && time() < $rangeStart || $rangeEnd && time() > $rangeEnd ) break;
So far, so good. However, In order to make my date range as inclusive of the last day in that range (eg: if the end date was Jun 30 then my query would still return true on Jun 30) I want to modify that
$rangeEnd by + 1 day.
Whatever method I try comes back with an error usually along the lines of "[...] parameter 1 to be DateTime, integer given" but when I try to change my integer into a DateTime object I get
"Uncaught Exception: DateTime::__construct(): Failed to parse time string".
Where am I going wrong?