wkilc Posted August 16, 2014 Share Posted August 16, 2014 Hi, I want to set two expiration dates in a form. Prior to the fall deadline, options A, B, C are displayed. After the fall date has passed, only A and B will be displayed. This works beautifully: <?php //SET THE TIME ZONE date_default_timezone_set('America/New_York'); //CREATE TIMESTAMP VARIABLES $current_ts = time(); $fall_deadline_ts = mktime(0,0,0,9,1,2014); $winter_deadline_ts = mktime(0,0,0,12,1,2014); //IF THE FALL DEADLINE HAS PASSED if($current_ts > $fall_deadline_ts) { echo "a, b"; } else { echo "a, b ,c"; } ?> How can I tweak this so that after the Winter deadline has ALSO passed, it will only display A, rather than A, B? Thanks! Link to comment https://forums.phpfreaks.com/topic/290478-showhide-content-expiration-date/ Share on other sites More sharing options...
fastsol Posted August 16, 2014 Share Posted August 16, 2014 if($current_ts > $winter_deadline_ts){ echo "a"; } elseif($current_ts > $fall_deadline_ts) { echo "a, b"; } else { echo "a, b ,c"; } Link to comment https://forums.phpfreaks.com/topic/290478-showhide-content-expiration-date/#findComment-1487917 Share on other sites More sharing options...
wkilc Posted August 16, 2014 Author Share Posted August 16, 2014 Brilliant! Thank you. Link to comment https://forums.phpfreaks.com/topic/290478-showhide-content-expiration-date/#findComment-1487919 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.