简体   繁体   中英

TimeStampDiff not working in MySql 5.0.3

Hey there -- Doing a simple TIMESTAMPDIFF query and I keep getting an error for my query. I tried the exact same query on a MySQL 5.5 engine and it worked fine..

SELECT TIMESTAMPDIFF(SECOND, current_timestamp(), current_timestamp()) AS time;

This is just a simple query to test the function out, normally it would return 0 on MySql 5.5, but on my 5.0 database it fails to run..

I've looked up if the function wasn't yet implemented, and it seems that in 5.0 it was introduced.. so not sure why this isn't working? I've checked the documentation on this function in 5.0 manual and it seems to be the same as 5.5..

Anyone know the work around? Thanks in advance

It seems there were some bugs with that function, on old versions of MySQL 5.0.x -- here's an example : Erratic behaviour of TIMESTAMPDIFF()

Note that MySQL 5.0.3 is really old -- you really should update to a more recent version :

  • You'll get more support
  • Lots of bug fixes
  • New features and enhancements
  • And, probably, better performances

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM