Re: [PHP] comparing dates works sometimes and fails another time!

2001-03-29 Thread trogers
You are doing a string compare not date, convert them to a unix time stamp and then compare $d1 = explode("-",$date1); $d2 = explode("-",$date2); $ts1 = mktime(0,0,0,$d1[1],$d1[2],$d1[0]); $ts2 = mktime(0,0,0,$d2[1],$d2[2],$d2[0]); if( $ts1 $ts2 ): echo "Date 1 is greater than date2";

Re: [PHP] comparing dates works sometimes and fails another time!

2001-03-28 Thread Renze Munnik
If you _do_ want to use this method for comparing dates (which isn't realy a usual way of doing it... there date-functions) you should fill up with leading 0's, like: $date1="2001-01-07"; $date2="2001-01-14"; The reason is _very_ simple... You performing a text-compare here. And let's face

Re: [PHP] comparing dates works sometimes and fails another time!

2001-03-28 Thread elias
What are appropriate functions to do Date and Time comparison? like: Date difference Date Comparison? Adding 'n' days to current date string value, Removing 'n' month, etc. Where can i find the date integer enconding used in PHP? Like i know how it's done in Delphi (as stored as a