mysql截取今年年份
时间: 2023-10-17 10:37:59 浏览: 96
MySql用DATE_FORMAT截取DateTime字段的日期值
5星 · 资源好评率100%
要在MySQL中截取今年的年份,可以使用EXTRACT函数。该函数允许从日期中提取指定的值。通过指定type参数为'year',可以提取出今年的年份。以下是一个示例:
SELECT EXTRACT(YEAR FROM CURDATE()) AS year;
这将返回当前日期的年份,即今年的年份。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [mysql——截取日期](https://blog.csdn.net/MirabelleZWH/article/details/120222498)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [MySQL截取字符串和转换日期格式](https://blog.csdn.net/TheChany/article/details/123885415)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文