Forum Moderators: coopster
The script compares that value to the current date - date("Ymd") - and does some stuff based on the comparison.
I need to enhance the script by making it compare the date AND time
That is what I need some guidance with.
I would like to enter my value as: 2008/02/19 18:05:00 (note the space between the date and the time).
Then have the script compare that to the current date and time.
How can I do that?
Thanks!
drop downs are common, you can plug the values from the drop downs into mktime() [php.net]
<?php
//to check against expiration date;
$currenttime = time();
$expirationtime = get_post_custom_values('expiration');//ENTERED AS 2008/02/19 18:00:00
if (is_null($expirationtime)) {
$expirestring = '30005050'; //MAKE UN-EXPIRING POSTS ALWAYS SHOW UP;
} else {
$expirestring = strtotime($expirationtime);
}if ( $expirestring > $currenttime ) { ?>
//HTML STUFF HERE
<?php
}
?>