Last post Jan 07, 2015 01:52 AM by Michelle Ge - MSFT
Jan 06, 2015 08:43 AM|raj1947|LINK
The User sent the times in minutes say ( 120 means its 2 hour), Then Workers hours will be 8 Am to 18 Pm, Now i need to find the Current time in-between 8 am to 18 pm and not less then 120 minutes. how to find it plzzz...
Jan 06, 2015 11:12 AM|SheldonS|LINK
In your database are the hours stored as DateTime?
If so you could do something like this:
SELECT (@userHours - DATEDIFF(hh, @dtStart, @dtEnd)) AS 'HoursDifference';
Jan 07, 2015 01:52 AM|Michelle Ge - MSFT|LINK
According to your description, you want to get the times where the time is between 8:00 and 18:00. If my understanding is your requirement, I think you need to store the times and submit DateTime into DataBase. For example, you have two columns are TimesSpan
and SubmitDate, then you can get the Data you want by the sql query below:
select TimesSpan from tables where TimesSpan > 120 and convert(varchar(10),SubmitDate,108)>convert(varchar(10),'2015/1/7 8:00:00') and convert(varchar(10),SubmitDate,108)<convert(varchar(10),'2015/1/7 18:00:00')
If my understanding is not correct, please refer to give more information about your requirement.
Hope it's useful for you.