For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > July 2004 > timestamp









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author timestamp
EniGMistA

2004-07-27, 3:58 pm

Hi,
I have 2 timestamp. How can I retrieve hours, minutes and secont between
them?

--

EniGMistA


Setec Astronomy

2004-07-27, 3:58 pm

EniGMistA wrote:

> I have 2 timestamp. How can I retrieve hours, minutes and secont
> between them?


Hi,
you mean UNIX timestamp or MySQL timestamp?

In the first case look http://www.php.net/date , in the second case
loot http://www.php.net/substr

--
I am what I am, I do what I can
L'uomo, conscio di sbagliare, persevera.
EniGMistA

2004-07-27, 3:58 pm

> In the first case look http://www.php.net/date , in the second case
> loot http://www.php.net/substr


I know PHP site. I think that this is a math problem :)

--

EniGMistA


Colin McKinnon

2004-07-27, 3:58 pm

EniGMistA wrote:

> Hi,
> I have 2 timestamp. How can I retrieve hours, minutes and secont between
> them?
>


something like:

$totseconds=$t2-$t1;
$sconds=$totseconds % 60;
$hours=(integer)($totseconds/3600);
$minutes=(integer(($totseconds % 3600)/60);

hth

C.
EniGMistA

2004-07-27, 3:58 pm

> $totseconds=$t2-$t1;
> $sconds=$totseconds % 60;
> $hours=(integer)($totseconds/3600);
> $minutes=(integer(($totseconds % 3600)/60);


Thanks. Olny a mistake:
$minutes=(integer(($totseconds % 3600)/60); >
$minutes=(integer)(($totseconds % 3600)/60);

--

EniGMistA


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com