Re: Minutes between tow dates
| From: | Richard Lynch | Date: | Fri, 03 Aug 2001 22:02:45 +0000 |
| Subject: | Re: Minutes between tow dates | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-61195@lists.php.net to get a copy of this message | ||
Something like:
select date_format('unix-timestamp', yoursessiontimestampcolumn) from
sessiontable;
Then, you can just use time() and subtract to get the number of seconds, and
divide by 60 for the minutes.
Or, better yet, you can use MySQL functions to select sessions that are
old/new or whatever, and leave all the data calculations in MySQL.
http://mysql.org
http://mysql.com
Dunno (or care) which has better docs now that they've split. Sigh.
--
WARNING richard@zend.com address is an endangered species -- Use
ceo@l-i-e.com
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: Augusto Cesar Castoldi <castoldi@inf.ufsc.br>
Newsgroups: php.general
To: <php-general@lists.php.net>
Sent: Friday, August 03, 2001 9:21 AM
Subject: Minutes between tow dates
> Hi.
>
> I'm using the timestamp format (AAMMDDHHMMSS) on my session.
>
> how can I know the minutes between two dates.
>
> I'm doing:
>
> $date = $row_secao['date'];
> $date_now=date("ymdHis");
> $x=$date_atual-$date;
> if ($x > 1000) {
> echo "Session expired.";
> }
>
> but I have a problem when turns the hour, like this:
>
> date=010803105958
> date_now=010803110518
>
> the sub is 4500 (45 minutes!), but in fact, the real time between is 6
> minutes...
>
> thanks.
>
> Augusto
>