Re: days between two timestamps

From: Date: Wed, 05 Jun 2002 15:19:37 +0000
Subject: Re: days between two timestamps
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-100724@lists.php.net to get a copy of this message
Hi All, Yes, they are mysql timestamps. I'll just use the query John suggested and modify it to fit my needs. I was originally going to do something like Martin suggested, but if I can do it right in MySQL, I'll do it that way. Thanks all! tyler ----- Original Message ----- From: "1LT John W. Holmes" <holmes072000@charter.net> To: "Tyler Longren" <tyler@captainjack.com>; "php-general" <php-general@lists.php.net> Sent: Wednesday, June 05, 2002 10:09 AM Subject: Re: [PHP] days between two timestamps > Since those look like MySQL timestamps, I would suggest you do it in your > query. > > SELECT TO_DAYS(column1) - TO_DAYS(column2) AS Difference FROM table > > Adapt to your needs. > > Explain what your overall mission is and there is probably a query that'll > return just that. > > If you want to use PHP, format those timestamps into something strtotime() > will convert to a unix timestamp, find the difference in seconds, and > convert the number of seconds into days. > > ---John Holmes... > > ----- Original Message ----- > From: "Tyler Longren" <tyler@captainjack.com> > To: "php-general" <php-general@lists.php.net> > Sent: Wednesday, June 05, 2002 11:01 AM > Subject: [PHP] days between two timestamps > > > > Hi, > > > > I have two different timestamps: > > 20020603164114 > > and > > 20020605054710 > > > > Is there a simple way to get the number of days between the two dates? > > > > thanks, > > tyler > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > >

« previous php.general (#100724) next »