I am currently using this to get yesterdays date, however i need to do something similar where the user will use a javascript datetimepicker in my asp.net page
and i will then use the date they select instead of just yesterdays date
Declare @dayselection int
set @dayselection = CONVERT(int,DateAdd(year, @YearToGet - Year(getdate() + 1),
DateAdd(day, DateDiff(day, 1, @dayToGet), 1) , DateAdd(month, DateDiff(month, 0, @monthToGet), 0) )
but it isnt working i keep getting syntax errors
I want the day and year functions to stay the same i just need help with the month part.
I need to convert the selected date into an int