Th开发者_JS百科e question i guess is kind of 2 questions:
- How do i even GET the current time in php and in a format that is easily compared to and
- Once i have that, i have a mysql timestamp in this format, 2011-06-30 04:33:00 , that I need to be compared to the php current time.
thank you so so much in advance, Binny
I'm assuming you're storing it as a DATETIME column.  As such, in MySQL
SELECT
    UNIX_TIMESTAMP(`date_column`) AS `timestamp`,
    ...
FROM
    ...
Then, in PHP:
$time_diff_in_seconds = time() - $query_result['timestamp']
However, I'd just let the database do it:
SELECT
    TIME_TO_SEC(TIMEDIFF(CURRENT_TIMESTAMP, `date_column`)) AS time_diff,
    ...
FROM
    ...
strtotime($query_result['timestamp'])
This will convert your MySQL timestamp value to the correct seconds since Jan 1, 1970 value. Then it's just a matter of subtracting the two to get the difference.
One thing you should check: are the two times coming from the same machine? If they are coming from different machines, you should worry about time zones and synchronization.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论