天天看點

mysql+curdate+昨天_MySQL内置時間curdate查詢用法

MySQL内置時間curdate查詢用法

文章作者:網友投稿 釋出時間:2010-08-15 10:02:19 來源:網絡

總結一下MySQL内置時間查詢用法 mysql SELECT year(curdate()); +-----------------+ | year(curdate()) | +-----------------+ | 2009 | +-----------------+ 1 row in set (0.00 sec) mysql SELECT month(curdate()); +------------------+ | month(curdate()) | +--------

總結一下MySQL内置時間查詢用法

mysql> SELECT year(curdate());

+-----------------+

| year(curdate()) |

+-----------------+

| 2009 |

+-----------------+

1 row in set (0.00 sec)

mysql> SELECT month(curdate());

+------------------+

| month(curdate()) |

+------------------+

| 8 |

+------------------+

1 row in set (0.00 sec)

mysql> SELECT day(curdate());

+----------------+

| day(curdate()) |

+----------------+

| 9 |

+----------------+

1 row in set (0.00 sec)

mysql> SELECT curdate();

+------------+

| curdate() |

+------------+

| 2009-08-09 |

+------------+

1 row in set (0.00 sec)

mysql> SELECT dayofmonth(curdate());

+-----------------------+

| dayofmonth(curdate()) |

+-----------------------+

| 9 |

+-----------------------+

1 row in set (0.00 sec)