0

Hello, I am really sorry for posting this here but I couldn't find anything
simular to the net. I need to insert datetime values into my mysql
db and in particular the current time second and minute value
and than I want to call this value and do a $current_time-$mysql_time
something like this and display just the minutes.
Thx in advance.

3
Contributors
4
Replies
6
Views
7 Years
Discussion Span
Last Post by BzzBee
0

checkout the online php and mysql manuals - loads of info there. It is suggested that you store this info as a unix timestamp (integer). You can use now() in mysql statements for current time.

Edited by diafol: n/a

0

checkout the online php and mysql manuals - loads of info there. It is suggested that you store this info as a unix timestamp (integer). You can use now() in mysql statements for current time.

Like 1 minute after I posted here I saw that with NOW() thx though
but whenever I do soemthing like
$timeleft=$time_fromdb-$NOWtime I get always 0 I dunno why.

0

not $now - now()! ANd in sql statement not in php.

BUT you can do this:

"SELECT TIMEDIFF(mydatetime,now())"

This takes the first datetime and subtracts the second datetime.

You can download the mysql manual from here:

http://dev.mysql.com/doc/

Look up Date and Time Functions

Edited by diafol: n/a

0

use it as

<?
$mydate= date('Y-m-d m:i:s'); 
OR
$mydate= gmdate('Y-m-d m:i:s'); 
?>

and use $mydate variable where you want to use.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.