Mar
13
2006
4

INTERVAL quirkyness

MySQL date and time commands annoy me almost as much as the MySQL online manual. I’m moving my office so my MySQL reference manual was in some box… and I had to resort to digging through the manual.

I don’t know why I always have a hard time remembering

SELECT DATE_SUB( NOW( ) , INTERVAL 7 DAY );

2006-03-06 17:03:21

SELECT NOW( ) - INTERVAL 7 DAY;

2006-03-06 17:06:54

I’m not sure what confused me… maybe the fact that I was trying to do INTERVAL 1 WEEK ;)

Written by Aaron Wormus in: Cookbook, MySQL |

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes