各个数据库中通过日期获取对应的周月份年份信息
sqlserver
获取当前年月日(2018-03-05):SELECT CONVERT(varchar(10), getdate(), 120); 获取当前年月日(20180305):SELECT CONVERT(varchar(10), getdate(), 112); 获取当月的第几天(05):SELECT DATENAME (day ,getdate()); 获取当年的第几页月(03):SELECT DATENAME (month ,getdate()); 获取当年的第几季度(3):SELECT DATENAME (quarter ,getdate()); 获取当前的第几天:SELECT DATENAME (dayofyear ,getdate()); 获取当前中第几周:SELECT DATENAME(week,GETDATE()); 获取当前星期几:SELECT DATENAME(weekday,GETDATE()); 获取当前几点,24小时制的:SELECT DATENAME(hour,GETDATE()); 获取当前分钟数:SELECT DATENAME(minute,GETDATE()); 获取当前秒数:SELECT DATENAME(second,GETDATE()); 获取当前毫秒:SELECT DATENAME(millisecond,GETDATE());
mysql
SELECT WEEK(date_add(now(),interval 6 day),2);
------------------------- A little Progress a day makes you a big success... ----------------------------