当前位置:Gxlcms > mysql > MySQL内置时间curdate查询用法

MySQL内置时间curdate查询用法

时间:2021-07-01 10:21:17 帮助过:36人阅读

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)

人气教程排行