RE: [PHP] comparing dates
| From: | Martin Towell | Date: | Sun, 01 Feb 2004 23:33:03 +0000 |
| Subject: | RE: [PHP] comparing dates | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-176532@lists.php.net to get a copy of this message | ||
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 and repeat the above..
HTH
Martin
> -----Original Message-----
> From: Ryan A [mailto:ryan@coinpass.com]
> Sent: Monday, 2 February 2004 10:04 AM
> To: php-general@lists.php.net
> Subject: [PHP] comparing dates
>
>
> 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 data as "select expire_login, now() from
> allow_logins";
>
> 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
>
> Been hitting the manual, but have either been searching in
> the wrong places
> or....?
> I think I will have to use "explode","strtotime" on
> this...but am not sure.
>
> Any help appreciated.
>
> Thanks,
> -Ryan
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> __________ Information from NOD32 1.614 (20040129) __________
>
> This message was checked by NOD32 for Exchange e-mail monitor.
> http://www.nod32.com
>
>
>
>