PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > alt.php > TIME calculation please :-/
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
TIME calculation please :-/

Réponse
 
LinkBack Outils de la discussion
Vieux 23/09/2007, 05h02   #1
Beshoo
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut TIME calculation please :-/

TIME calculation please :-/

hi gaiz !!
just aim trying to make a fucntion to calculate a period of time
aim making trfic website analysis I mean for example i must know
when a user is logedon and logedOut So i can know the period he
has spent in the site !!! ??
Ofcourse i have the to time[when he login and logout] i am tring to
make fucntion to caleculate the period between thes 2 time !!!!

fore example i have loged in at :

12:30
and logged out at :
1:10

there must be 40 mints !!??
i wirte my script bt it has alot of problems!!

thanx in advance !!

  Réponse avec citation
Vieux 23/09/2007, 08h12   #2
J.O. Aho
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: TIME calculation please :-/

Beshoo wrote:
> TIME calculation please :-/
>
> hi gaiz !!
> just aim trying to make a fucntion to calculate a period of time
> aim making trfic website analysis I mean for example i must know
> when a user is logedon and logedOut So i can know the period he
> has spent in the site !!! ??
> Ofcourse i have the to time[when he login and logout] i am tring to
> make fucntion to caleculate the period between thes 2 time !!!!
>
> fore example i have loged in at :
>
> 12:30
> and logged out at :
> 1:10
>
> there must be 40 mints !!??
> i wirte my script bt it has alot of problems!!


quite simply you could convert the two times to unixtime and then:
unixtime_logout - unixtime_login = seconds between login and logout

then you have only to convert the seconds to days/hours/minutes/seconds

--

//Aho
  Réponse avec citation
Vieux 24/09/2007, 01h24   #3
Steve
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: TIME calculation please :-/


"Beshoo" <basheermoro@gmail.com> wrote in message
news:1190520136.273814.23720@19g2000hsx.googlegrou ps.com...
> TIME calculation please :-/
>
> hi gaiz !!


gaiz? as in pronunciation, 'gays'?

> just aim trying to make a fucntion to calculate a period of time
> aim making trfic website analysis I mean for example i must know
> when a user is logedon and logedOut So i can know the period he
> has spent in the site !!! ??


you'll have a heck of a time getting determining when someone 'logged out'.
you'll have to come up with a scheme to do that...one that says here is a
significant gap in time, i suppose the last page visited was when they left
the site since the last log in.

do *you* ever log out of a site, or do you just leave? i certainly don't
bother to log out.

> Ofcourse i have the to time[when he login and logout] i am tring to
> make fucntion to caleculate the period between thes 2 time !!!!
>
> fore example i have loged in at :
>
> 12:30
> and logged out at :
> 1:10
>
> there must be 40 mints !!??
> i wirte my script bt it has alot of problems!!


oh, you mean "a lot". "alot" isn't a word..."allot" is, however you
aren't assigning or setting anything aside in the context of the sentence.
but, i digress...

>
> thanx in advance !!


once you get all your stuff in place, here's a standard dateDiff
function...it's not much from there to get a function to say 'n day(s), n
hour(s), n minute(s)', if you need that. but, here's the basic function:

function dateDiff($firstDate, $secondDate, $interval = 'd')
{
$intervals = array(
'y' => (365.25 * 24 * 60 * 60) ,
'm' => (30 * 24 * 60 * 60) ,
'w' => (7 * 24 * 60 * 60) ,
'd' => (24 * 60 * 60) ,
'h' => (60 * 60) ,
'n' => 60 ,
's' => 1
);
return floor(abs($firstDate - $secondDate) / $intervals[$interval]);
}


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 23h34.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,08513 seconds with 11 queries