SELECT NOW(); +---------------------+ | NOW() | +---------------------+ | 2015-05-31 18:29:33 | +---------------------+ SELECT DATE_HIRE, DATE_ADD(DATE_HIRE, INTERVAL 1 DAY), DATE_HIRE + 1 FROM EMPLOYEE_PAY_TBL; +------------+-------------------------------------+---------------+ | DATE_HIRE | DATE_ADD(DATE_HIRE, INTERVAL 1 DAY) | DATE_HIRE + 1 | +------------+-------------------------------------+---------------+ | 2004-08-14 | 2004-08-15 | 20040815 | | 2006-07-22 | 2006-07-23 | 20060723 | | 1999-05-23 | 1999-05-24 | 19990524 | | 2007-06-28 | 2007-06-29 | 20070629 | | 2000-06-17 | 2000-06-18 | 20000618 | | 2001-01-14 | 2001-01-15 | 20010115 | +------------+-------------------------------------+---------------+ SELECT DAYNAME(DATE_HIRE) FROM EMPLOYEE_PAY_TBL; +--------------------+ | DAYNAME(DATE_HIRE) | +--------------------+ | Saturday | | Saturday | | Sunday | | Thursday | | Saturday | | Sunday | +--------------------+ SELECT DAYOFMONTH(DATE_HIRE) FROM EMPLOYEE_PAY_TBL; +-----------------------+ | DAYOFMONTH(DATE_HIRE) | +-----------------------+ | 14 | | 22 | | 23 | | 28 | | 17 | | 14 | +-----------------------+ SELECT DAYOFWEEK(DATE_HIRE) FROM EMPLOYEE_PAY_TBL; +----------------------+ | DAYOFWEEK(DATE_HIRE) | +----------------------+ | 7 | | 7 | | 1 | | 5 | | 7 | | 1 | +----------------------+ SELECT DAYOFYEAR(DATE_HIRE) FROM EMPLOYEE_PAY_TBL; +----------------------+ | DAYOFYEAR(DATE_HIRE) | +----------------------+ | 227 | | 203 | | 143 | | 179 | | 169 | | 14 | +----------------------+
时间: 2024-11-05 11:54:00