PHP: If statement grater or equal to date

  • demonmaestro
  • Gold Member
  • Gold Member
  • User avatar
  • Posts: 679
  • Loc: Conroe, Texas

Post 3+ Months Ago

what am i doing wrong here..??? its going to be for a user subscribe thing.

PHP Code: [ Select ]
<?
 
/* The Date needs to be between or equal to the begin and end date. If not between or equal to date then something needs to be shown...*/
$date = date("Y-m-d");
$begin = "2012-11-13";
$end = "2012-12-30";
 
echo $date;
echo" - date<br>";
echo $begin;
echo" - begin<br>";
echo $end;
echo" - end<br><br>";
 
 
$log = $begin <=$date;
echo $log;
echo " - log<br>";
$log1 = $date >= $end;
echo $log1;
echo " - log1<br>";
 
if($log == $log1){ echo "something";}
?>
  1. <?
  2.  
  3. /* The Date needs to be between or equal to the begin and end date. If not between or equal to date then something needs to be shown...*/
  4. $date = date("Y-m-d");
  5. $begin = "2012-11-13";
  6. $end = "2012-12-30";
  7.  
  8. echo $date;
  9. echo" - date<br>";
  10. echo $begin;
  11. echo" - begin<br>";
  12. echo $end;
  13. echo" - end<br><br>";
  14.  
  15.  
  16. $log = $begin <=$date;
  17. echo $log;
  18. echo " - log<br>";
  19. $log1 = $date >= $end;
  20. echo $log1;
  21. echo " - log1<br>";
  22.  
  23. if($log == $log1){ echo "something";}
  24. ?>
  • demonmaestro
  • Gold Member
  • Gold Member
  • User avatar
  • Posts: 679
  • Loc: Conroe, Texas

Post 3+ Months Ago

I'm a idiot. I try to make things too complicated at times. This works..

PHP Code: [ Select ]
/* The Date needs to be between or equal to the begin and end date. If not between or equal to date then something needs to be shown...*/
$date = date("Y-m-d");
$end = "2012-12-05";
 
echo $date;
echo" - date<br>";
 
echo $end;
echo" - end<br><br>";
 
if($date >= $end){ echo "something";}
  1. /* The Date needs to be between or equal to the begin and end date. If not between or equal to date then something needs to be shown...*/
  2. $date = date("Y-m-d");
  3. $end = "2012-12-05";
  4.  
  5. echo $date;
  6. echo" - date<br>";
  7.  
  8. echo $end;
  9. echo" - end<br><br>";
  10.  
  11. if($date >= $end){ echo "something";}

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 126 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.