Home  >  Article  >  Database  >  MySQL内置时间curdate查询用法

MySQL内置时间curdate查询用法

WBOY
WBOYOriginal
2016-06-07 14:53:261624browse

mysql SELECT year(curdate()); +-----------------+ | year(curdate()) | +-----------------+ | 2009 | +-----------------+ 1 row in set (0.00 sec) mysql SELECT month(curdate()); +------------------+ | month(curdate()) | +------------------+

  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)

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn