[RESOLVED] Creating a Date in SQL Server?
I need to create a Date Field to return to a VB.Net app based on the current month/year, however the day needs to be the 1st day of the month. Here is what I have and it's not working.
Code:
Convert(DateTime, Month(GetDate()) + '/1/' + Year(GetDate()), 101) as DayOne
How would I do this? I can't find any examples online.
Re: Creating a Date in SQL Server?
Month and Year return numbers. You can't add a number and a string. You need a string, so convert the numbers to strings. You can then concatenate all the strings and then convert the result to a datetime.
Re: Creating a Date in SQL Server?