For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > July 2005 > RE: [PHP-DB] Timediff/Subtime questions









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 RE: [PHP-DB] Timediff/Subtime questions
Bastien Koert

2005-07-26, 5:00 pm

try combining it with php

$now = date("Y-m-d H:i:s")

$sql = "select timediff($now, logouttime) from tblUserTracking";

Bastien

>From: Chuck Brockman <cjbrockman@gmail.com>
>Reply-To: Chuck Brockman <cjbrockman@gmail.com>
>To: php-db@lists.php.net
>Subject: [PHP-DB] Timediff/Subtime questions
>Date: Tue, 26 Jul 2005 13:48:39 -0400
>
>I've got a table that has a field logouttime which is a timestamp.
>I've tried using the timediff() function in mysql and get an error:
>
>select timediff(now(), logouttime) from tblUserTracking
>
>Each time it returns (err). However, if I used a query such as:
>
>select timediff('2005-07-26 22:00:00.0', '2005-07-26 20:00:00.0',)
>
>I get the appropriate return. I am running mysql 4.1.12. Can
>timediff() be used in such a manner as the first example? I've tried
>subtime but get NULL for return values.
>
>Thanks
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>

Sponsored Links







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

Copyright 2008 codecomments.com