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,
Is there a quick way to compare dates in the format dd/mm/yy without
exploding and comparing the individual parts?
R.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
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
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
nderstands and repeat the above..
HTH
Martin
> -Original Message-
> From: Ryan A [mailto:[EMAIL PROTECTED]
> Sent: Monday, 2 February 2004 10:04 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] comparing dates
>
>
> Hi,
> Am a bit confused as to how to do this, I
Hi,
Am a bit confused as to how to do this, I have some dates in the database as
"expire_login timestamp(14)".
I am entering dates 1 day,11 hours,59 minutes in advance.
The user can sign in anytime and it should display how many days, hours and
mins before his account expires...
I am selecting the
xpl[1],$yd_expl[2],$yd_expl[3],$yd_expl[4],$yd_expl[5])
){
// do you have to do
}
HTH
Regards,
Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
BALANCED SOLUTIONS
- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, December 09, 2001
r 08, 2001 8:16 PM
Subject: [PHP] Comparing Dates
I'm trying to do a check on a date, to see if it's after the current date,
so basically i'm doing an
if(date("d-m-y")>"15-12-01") { do something }
I know that's obviously not the right way to do it, but c
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 cu
I'm trying to do a check on a date, to see if it's after the current date, so
basically i'm doing an
if(date("d-m-y")>"15-12-01") { do something }
I know that's obviously not the right way to do it, but can someone help me out?
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";
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
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...
Hi!
$date1="2001-1-7";$date2="2001-1-14";
if ($date1>=$date2) echo "date1 is greater then date2";
else echo "date2 is greater then date1";
the result is the first :(
but it works for other dates!
Thanks
_
Get Your Private,
14 matches
Mail list logo