Select Exact Day
-
Hi...i have created a system that allows users to select process start dates and end dates, then they can select specific days for the process to run eg(Monday and Thursday), is there any possible way for me to get the exact date they specified eg: start date: 2008/09/10 and end date: 2008/09/20, they select Monday as specified date.. now is there a way to select the start date to be the first monday of the start date... scheduled dates: 2008/09/15 and 2008/09/18. Is there a wat to do this?
living life on the flip side
-
Hi...i have created a system that allows users to select process start dates and end dates, then they can select specific days for the process to run eg(Monday and Thursday), is there any possible way for me to get the exact date they specified eg: start date: 2008/09/10 and end date: 2008/09/20, they select Monday as specified date.. now is there a way to select the start date to be the first monday of the start date... scheduled dates: 2008/09/15 and 2008/09/18. Is there a wat to do this?
living life on the flip side
Of course... SELECT DATEPART(dw, GETDATE()) AS 'Today' This gives you the day of the week (as an index), so if the first day is Monday (this is culture-dependent) the function returns 5 today, since today is Friday. So just test the start date and you'll know what day of the week that is. Based on that it's pretty easy to figure out how many days it is until any given day. :)
-
Of course... SELECT DATEPART(dw, GETDATE()) AS 'Today' This gives you the day of the week (as an index), so if the first day is Monday (this is culture-dependent) the function returns 5 today, since today is Friday. So just test the start date and you'll know what day of the week that is. Based on that it's pretty easy to figure out how many days it is until any given day. :)