habanero25 Posted October 22, 2007 Share Posted October 22, 2007 Hello, I'm having trouble writing a program that checks if a date is in between two other dates or not. $today = date("d-m-y"); $a = "09-09-06"; //September 9th, 2006 $c = "09-09-09"; //September 9th, 2009 if($a <= $today && $today<$c){ echo "Wee"; } else{ echo "Wrong"; } When I try outputting this, it outputs always outputs "Wrong" for some reason, although $today is clearly inbetween $a and $c (Sept.09'06 and Sept.09'09). Am I doing something wrong? Thanks, Habanero Quote Link to comment https://forums.phpfreaks.com/topic/74361-date-comparison/ Share on other sites More sharing options...
ccrevcypsys Posted October 22, 2007 Share Posted October 22, 2007 I dunno if this is it but have you tried this $today = date("dmy"); ?? Quote Link to comment https://forums.phpfreaks.com/topic/74361-date-comparison/#findComment-375700 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.