Thu Feb 12 16:41:42 CET 2009

those annoying inconsistencies

Just a very short addition to my unexpected mysql timestamp behaviour: Once again I was fooled by the following:

mysql> select datediff(now(), '2009-01-01');
+-------------------------------+
| datediff(now(), '2009-01-01') |
+-------------------------------+
| 42 |
+-------------------------------+
1 row in set (0.00 sec)

which is fine. But on the other hand:

mysql> select timestampdiff(day, now(), '2009-01-01');
+-----------------------------------------+
| timestampdiff(day, now(), '2009-01-01') |
+-----------------------------------------+
| -42 |
+-----------------------------------------+
1 row in set (0.00 sec)

This is more or less just as bad as all those inconsistencies among php functions with their always surprising naming and parameter order..


Posted by iso | Permanent Link | Tags: php, mysql, annoyance | comments >>