sqlservermysql
獲取當前年月日(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());
mysqlsql
SELECT WEEK(date_add(now(),interval 6 day),2);