Re: [PHP] comparing dates

2005-09-20 Thread Philip Hallstrom
Is there a quick way to compare dates in the format dd/mm/yy without exploding and comparing the individual parts? Compare them in what way? Before, after, days between? In any case, i'd look at strtotime() to convert them into timestamps, then diff them to get the number of seconds b/n them,

Re: [PHP] comparing dates

2004-02-01 Thread Ryan A
have the user comments. Cheers, -Ryan http://Bestwebhosters.com - Original Message - From: "Justin French" <[EMAIL PROTECTED]> To: "Ryan A" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, February 02, 2004 1:21 AM Subject: Re: [PHP] com

Re: [PHP] comparing dates

2004-02-01 Thread Justin French
On Monday, February 2, 2004, at 10:04 AM, Ryan A wrote: which gives me two 14 numberic characters strings like: 20040202091212 20040201070500 How do I compare it to display something like this to the visitor: You have $xdays day/s, $xhours hours and $xmins minutes before your account expires Be

RE: [PHP] comparing dates

2004-02-01 Thread Martin Towell
Is it possible to pull that dates out as unix time stamps? Then all you need to do is subtract one from the other, convert the results to days/hours/minutes and Bob's your uncle. If not, then you'll need to do some string manipulation to get the string into a format that strtotime() understands a

Re: [PHP] Comparing Dates

2001-12-12 Thread Andrey Hristov
$timestamp = time(); $yourdate="12:35:20:7:4:2001"; // 12:35:07 July 4 2001 $yd_expl = explode(':',$yourdate); if (mktime(0,0,0,strftime('%m',$timestamp),strftime('%d',$timestamp),strftime('%Y',$timestamp) < mktime($yd_expl [0],$yd_expl[1],$yd_expl[2],$yd_expl[3],$yd_expl[4],$yd_expl[5])

Re: [PHP] Comparing Dates

2001-12-08 Thread Alex Shi
Absolutely you are doing in the right way:) But pls make sure that string comparison is from left to right. For example, "16" is larger than "15-12-01". Alex - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, December 08, 2001 8:16 PM Subject: [PHP] C

RE: [PHP] Comparing Dates

2001-12-08 Thread Jack Dempsey
you could pass the values to mktime and compare -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Saturday, December 08, 2001 8:17 PM To: [EMAIL PROTECTED] Subject: [PHP] Comparing Dates I'm trying to do a check on a date, to see if it's after the current date,

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 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 Doub

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 it...