php and mysql date time difference

前端 未结 4 738
轮回少年
轮回少年 2021-01-24 15:20

I did this in php to store the lastlogin in a mysql datetime column

date(\'Y-m-d h:i:s\') //which then gave > \'2014-01-04 08:00:56\'

and th

4条回答
  •  感动是毒
    2021-01-24 15:42

    I don't think that this would be a timezone issue because PHP and MySQL both are running on same machine so both would be getting same time on calling current datetime. May be you can try this because I tried this on my machine as you said.

    SELECT * FROM `elc_users` WHERE lastlogin < date_add(NOW(), INTERVAL -20 MINUTE) 
    

提交回复
热议问题