首页  >  文章  >  数据库  >  MySQL内置时间curdate查询用法

MySQL内置时间curdate查询用法

WBOY
WBOY原创
2016-06-07 14:53:261625浏览

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)

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn