返回date的字符串如何分开获取

2025-05-07 12:21:02
推荐回答(1个)
回答1:

可用month函数获取月份。
测试方法:
1、创建一个含有date类型的表,并在表中插入数据(数据日期为当前时间):

1
2
3
4
5

create table test
(id int,
begin_date date)

insert into test values (1,getdate())

2、执行语句,获取月份:

1

select MONTH(begin_date) from test

3、执行结果: