Working with "time" data from MYSQL

Hi

I have a MYSQL/PHP question for which I do not find an answer on the web.

I have a MySQL table with a column of datatype "time". What I want to do is
read the values from this table but display the database entries plus 6
hours. For example, when the database entry is 12:00:00, I want to display
18:00:00 on my website.

I tried all kinds of tricks, with strtotime() in PHP and UNIX_TIMESTAMP() in
MySQL, but I simply cannot figure it out.
When I start with normal strings instead of times, it works fine in PHP, but
I do not manage to convert the MySQL time data into strings.

Thanks for any advise!
Sebastian



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Sebastian Hofferberth [ Do, 05 Juni 2008 00:40 ] [ ID #1955218 ]

Re: Working with "time" data from MYSQL

Sebastian Hofferberth wrote:
> Hi
>
> I have a MYSQL/PHP question for which I do not find an answer on the web.
>
> I have a MySQL table with a column of datatype "time". What I want to do is
> read the values from this table but display the database entries plus 6
> hours. For example, when the database entry is 12:00:00, I want to display
> 18:00:00 on my website.
>
> I tried all kinds of tricks, with strtotime() in PHP and UNIX_TIMESTAMP() in
> MySQL, but I simply cannot figure it out.

Probably easiest with a native mysql function:

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functio ns.html#function_addtime

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
dmagick [ Do, 05 Juni 2008 03:38 ] [ ID #1955220 ]
PHP » gmane.comp.php.database » Working with "time" data from MYSQL

Vorheriges Thema: Help in concatenation
Nächstes Thema: Navigation Help