I am currently new in C# & SQL.
How do I get the current month and year in SQL Server 2008 R2?
SQL Server
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With