Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我目前是 C# & SQL 的新手。
如何在 SQL Server 2008 R2 中获取当前月份和年份?
SQL 服务器
SELECT GETDATE() AS CurrentDateTime , YEAR(GETDATE()) AS CurrentYear , MONTH(GETDATE()) AS CurrentMonth
C#
var now = DateTime.Now; var currentYear = now.Year; var currentMonth = now.Month;