sql server从数据库表中读取不同的日期格式

这是从表中查询的时间的格式:

select DISTINCT  year(Time) from rdata  //从数据库表中读取时间筛选出   年

select DISTINCT  month (Time) from rdata   //从数据库表中读取时间筛选出   月份

select DISTINCT  day (Time) from rdata     //从数据库表中读取时间筛选出   天

在数据库中使用sql语句,获取当前时间的各种格式:

select  datenam(year,getdate())  as "年";

猜你喜欢

转载自www.cnblogs.com/lypstudy/p/10028188.html
今日推荐