Hi,
sorry if maybe this is a bit dumb question, but I'm a begginer with php...
I got a mysql database, where two of the fields of a table record times as
CHAR(8) in the format hh:mm:ss
I want to take this two times and get the difference between them in
seconds, for example 12:01:30 - 12:00:00
Message -
From: juaid [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, June 07, 2002 8:01 PM
Subject: [PHP] convertion from string to time substracting
Hi,
sorry if maybe this is a bit dumb question, but I'm a begginer with php...
I got a mysql database, where two of the fields
: Friday, June 07, 2002 2:02 PM
To: [EMAIL PROTECTED]
Subject: [PHP] convertion from string to time substracting
Hi,
sorry if maybe this is a bit dumb question, but I'm a begginer with
php...
I got a mysql database, where two of the fields of a table record
times as
CHAR(8) in the format
From: Chris Knipe [EMAIL PROTECTED]
Talking under correction, but you'll be better of using a TIME column in
MySQL. You can also do all the calculations with MySQL's build in time
functions already, which will save you allot of time, seeing that all the
calculations can be done via a single
On Friday, June 7, 2002, at 02:01 PM, juaid wrote:
sorry if maybe this is a bit dumb question, but I'm a begginer with
php...
I got a mysql database, where two of the fields of a table record times
as
CHAR(8) in the format hh:mm:ss
I want to take this two times and get the difference
On Friday, June 7, 2002, at 02:22 PM, Erik Price wrote:
First of all, if you're storing time then you're better off using the
DATETIME column type. Even though it may take a bit more space than
CHAR(8), unless you absolutely need the ultimate in table optimization,
use DATETIME.
I
note that I put:
$startTime = $linea[startTime];
I misppeled it while copying, this shuold be
$startTime = $line[startTime];
juaid
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
] convertion from string to time substracting
On Friday, June 7, 2002, at 02:01 PM, juaid wrote:
sorry if maybe this is a bit dumb question, but I'm a begginer with
php...
I got a mysql database, where two of the fields of a table record
times
as
CHAR(8) in the format hh:mm:ss
to get exactly what you need
if you use the correct column types.
---John Holmes
-Original Message-
From: juaid [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 07, 2002 2:20 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] convertion from string to time substracting
From: Chris
Thank you very much Erik, I'll try it :)
anyway, it would be nice to know what's wrong with the code I posted, why
does it work with CHAR and not with TIME types?
juaid
From: Erik Price [EMAIL PROTECTED]
First of all, if you're storing time then you're better off using the
DATETIME column
Talking under correction, but you'll be better of using a TIME column in
MySQL. You can also do all the calculations with MySQL's build in time
functions already, which will save you allot of time, seeing that all
the
calculations can be done via a single SQL query.
Yes, this is the
From: John Holmes [EMAIL PROTECTED]
That error means your query failed and the result set is not valid. You
can't use LIKE on a TIME column.
Can you explain exactly what you want? How are you storing the times,
what are the times, what kind of data do you want to pull out of the
table?
- Original Message -
From: John Holmes [EMAIL PROTECTED]
To: 'juaid' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, June 07, 2002 8:29 PM
Subject: RE: [PHP] convertion from string to time substracting
That error means your query failed and the result set is not valid. You
can't
where $month, $day and $year are got from a form in the previous page via
POST method.
So the LIKE condition matches against the date field in the table, where
the format is like Jun 7 2002
if I switch connTime, startTime and stopTime to TIME types, I get the
error
I said
I'll try the
From: Chris Knipe [EMAIL PROTECTED]
I also started off implementing mysql lookups
without error checking and posted rather silly mistakes to the list which
could have easily been avoided just debugging the code properly
%$@#!!!
thank you very much Chris... stupid error.. I had done so many
PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] convertion from string to time substracting
- Original Message -
From: John Holmes [EMAIL PROTECTED]
To: 'juaid' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, June 07, 2002 8:29 PM
Subject: RE: [PHP] convertion from string to time
UNIX_TIMESTAMP() in your query, then you won't
need any of that PHP code you just wrote...
---John Holmes...
-Original Message-
From: Erik Price [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 07, 2002 2:22 PM
To: juaid
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] convertion from string to time
, 2002 3:27 PM
To: [EMAIL PROTECTED]
Cc: 'juaid'; [EMAIL PROTECTED]
Subject: Re: [PHP] convertion from string to time substracting
I thought that it was a CHAR column. I didn't know you could use
UNIX_TIMESTAMP() on CHAR columns, so I was showing him how to turn his
colon delimited strings
I got a mysql database, where two of the fields of a table
record times as
CHAR(8) in the format hh:mm:ss
This is one of those situations where having your database using the
most appropriate field types would help. When you've got it as CHAR
there's little you can do in the way of
I got a mysql database, where two of the fields of a table
record times as
CHAR(8) in the format hh:mm:ss
I want to take this two times and get the difference between
them in seconds, for example 12:01:30 - 12:00:00 = 90 I
looked up at the doc in the php.net website and couldn't
20 matches
Mail list logo