[RESOLVED] How to determine if year is current
Hi,
how do i filter the dates in the table using a query that will only display dates corresonding to the current year...
Assuming that the table has dates from 2000-2008..When I run the program, it will display the all dates in the gridview with year 2008...
Whats the date function to do this?
Whats a function to display if the month is also current?
using sql server 2005..
Table name:
Calendar
fields:
CalendarDate (datetime)
CalendarIsCurrentDate (bit)
CalendarWorkingDayType (varchar(50))
Utilized(bit)
thnx:)
Re: How to determine if year is current
you can use
WHERE YEAR(CalendarDate ) = 2008
Re: How to determine if year is current
if you dont want to pass parameter you can use
Code:
select *
FROM Calendar
WHERE YEAR(CalendarDate ) = YEAR(GetDate()) AND MONTH(CalendarDate ) = MONTH(GetDate())